問題文
function solution(target, patch)を書いてください。入出力はJSON値です。入力配列やオブジェクトを変更しないでください。外部ライブラリ・ネットワーク・非同期関数は使えません。 target and patch are JSON values. A nonobject patch (including null and arrays) replaces the entire target. For an object patch, start with {} if target is not an object. Delete keys whose patch value is null; recursively apply all other keys. Replace arrays wholesale. Preserve input and treat '__proto__' and 'constructor' as ordinary data keys. Maximum depth 20. 入力範囲:各入力配列は最大50,000項目、文字列は最大1,000文字です。数値は有限値で、整数と整数の合算結果はJavaScriptの安全な整数範囲内です。その他の型と有効性は上記の規則に従います。
入出力例
例 1
関数の引数
[
{
"a": 1,
"b": 2
},
{
"a": null,
"c": 3
}
]戻り値
{
"b": 2,
"c": 3
}例 2
関数の引数
[
{
"nested": {
"a": 1,
"b": 2
}
},
{
"nested": {
"a": 3
}
}
]戻り値
{
"nested": {
"a": 3,
"b": 2
}
}例 3
関数の引数
[
{
"a": true
},
{
"a": false
}
]戻り値
{
"a": false
}