Deep Merge Strict Types

JavaScript Hard 6 views
Back to Questions

Problem Description

Two JSON objects are given on two lines. Deep merge them: object+object merges keys, array+array concatenates, primitives override. But if types mismatch (like object vs array), stop and print TYPE_MISMATCH path.

Input Format

Line1: JSON object A. Line2: JSON object B.

Output Format

One line output.

Sample Test Case

Input:
{"a":{"x":1}} {"a":[1,2]}
Output:
TYPE_MISMATCH a

Constraints

Total nodes up to 2e5.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev