PayPal's "Conditional Deep Copy" interview problem focuses on implementing a deep copy of a nested object structure with specific conditions on which properties to copy, using recursion. Despite extensive searches, no verifiable full problem statement, input/output examples, or constraints were found across coding platforms, PayPal's developer docs, or interview repositories like LeetCode, Glassdoor, or GitHub collections.[1][4]
This problem typically involves creating a deep copy of a JavaScript/TypeScript object (e.g., nested arrays/objects) where copying is conditional—such as skipping circular references, excluding certain keys (like functions or symbols), or only copying values meeting criteria like non-null primitives. Recursion handles nesting, while Object/Object.assign with iteration avoids shallow copies.[4]
`javascript function conditionalDeepCopy(obj, visited = new WeakMap()) { if (obj === null || typeof obj !== 'object') return obj; if (visited.has(obj)) return null; // Condition: skip cycles visited.set(obj, true);
if (Array.isArray(obj)) { return obj.map(item => conditionalDeepCopy(item, visited)); }
const copy = {};
for (let key in obj) {
if (obj.hasOwnProperty(key) && typeof obj[key] !== 'function') { // Condition: skip functions
copy[key] = conditionalDeepCopy(obj[key], visited);
}
}
return copy;
}
**Input:**{ a: 1, b: { c: 2 }, d: [3, { e: 4 }] }`
Output: Identical structure (deep copied).[4]
No official PayPal-tagged examples exist publicly; similar problems appear in general coding interviews for object manipulation roles.