Skip to content

Instantly share code, notes, and snippets.

View divyanshbhowmick's full-sized avatar
🏠
Working from home

Divyansh Bhowmick divyanshbhowmick

🏠
Working from home
View GitHub Profile
// Best Case is O(1) worst case in O(n)
// where n is the no of nodes in the tree represented by the object
function deepCheck(obj1, obj2) {
// If they are equal Primitives (think as leaf nodes) or they refer to same memory
if (obj1 === obj2) return true;
// If Both are NaN
if (obj1 === NaN && obj2 === NaN) return true;