Differences Between Two Objects — LeetCode 2700 Python Solution
MediumLeetCode PremiumJavaScript
- Problem
- #2700
- Reading time
- 2 min
- Source
- leetcode.com
The problem
Write a function that accepts two deeply nested objects or arrays obj1 and obj2 and returns a new object representing their differences. The function should compare the properties of the two objects and identify any changes.
Example
- Input
- obj1 = {}
- Output
- {}
- Explanation
- There were no modifications made to obj1. New keys "a" and "b" appear in obj2, but keys that are added or removed should be ignored.
Complexity
| Measure | Complexity |
|---|---|
| Time | O(n) |
| Space | O(1) to O(n) auxiliary |
Related problems
Frequently asked questions
- How hard is LeetCode 2700. Differences Between Two Objects?
- LeetCode 2700. Differences Between Two Objects is rated Medium on LeetCode.
- What topics does LeetCode 2700. Differences Between Two Objects cover?
- LeetCode 2700. Differences Between Two Objects is tagged JavaScript on LeetCode.
- Is LeetCode 2700. Differences Between Two Objects a premium problem?
- Yes. LeetCode 2700. Differences Between Two Objects is a LeetCode Premium problem, so the full statement and test cases require a paid LeetCode subscription.