{"ScriptPreparationCode":null,"TestCases":[{"Name":"custom solution","Code":"const array1 = []\r\nconst array2 = []\r\nfor (let i = 0; i \u003C= 100; i\u002B\u002B) {\r\n array1.push(i)\r\n}\r\nfor (let i = 99; i \u003E= 0; i--) {\r\n array2.push(i)\r\n}\r\n\r\nfunction equivalent(arr1, arr2) {\r\n if (arr1.length !== arr2.length) {\r\n return false\r\n }\r\n arr1.forEach((elem) =\u003E {\r\n const index = arr2.findIndex((elem2) =\u003E elem === elem2)\r\n if (index === -1) { // not found\r\n return false\r\n }\r\n arr2.splice(index, 1) // remove element\r\n })\r\n if (arr2.length \u003E 0) { // if still values in arr2, they are not in arr1\r\n return false\r\n }\r\n return true\r\n}\r\n\r\nconst res = equivalent(array1, array2)\r\nconsole.log(res)","IsDeferred":false},{"Name":"loadash solution","Code":"const array1 = []\r\nconst array2 = []\r\nfor (let i = 0; i \u003C= 100; i\u002B\u002B) {\r\n array1.push(i)\r\n}\r\nfor (let i = 100; i \u003E= 0; i--) {\r\n array2.push(i)\r\n}\r\n\r\nfunction equivalent(arr1, arr2) {\r\n if (arr1.length !== arr2.length) {\r\n return false\r\n }\r\n \tconst sorted1 = _.orderBy(arr1)\r\n const sorted2 = _.orderBy(arr2)\r\n return _.isEqual(sorted1, sorted2)\r\n}\r\n\r\nconst res = equivalent(array1, array2)\r\nconsole.log(res)","IsDeferred":false}]}