Search
⌘K

Leetcode 2705. Compact Object

Recursively traverse the JSON-derived object/array and remove any keys or array elements whose values are falsy, returning the same structure with falsy-valued properties/elements deleted. Arrays should be treated as keyed objects (i.e., filter out falsy elements) and the compaction applies to all nested objects/arrays.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.