This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |