{"ScriptPreparationCode":null,"TestCases":[{"Name":"join","Code":"const quickSort = (arr) =\u003E {\r\n if (arr.length \u003C= 1) {\r\n return arr\r\n }\r\n\r\n const pivot = arr[0]\r\n const left = []\r\n const right = []\r\n\r\n for (let i=1; i\u003Carr.length; i\u002B\u002B) {\r\n if (arr[i] \u003C pivot) {\r\n left.push(arr[i])\r\n } else {\r\n right.push(arr[i])\r\n }\r\n }\r\n\r\n return [...quickSort(left), pivot, ...quickSort(right)]\r\n}\r\n\r\nconst isPermutation = (a, b) =\u003E {\r\n if (a === b) {\r\n return true\r\n }\r\n\r\n if (a.length !== b.length) {\r\n return false\r\n }\r\n\r\n const sortedA = quickSort(a)\r\n const sortedB = quickSort(b)\r\n\r\n return sortedA.join(\u0027\u0027) === sortedB.join(\u0027\u0027)\r\n}\r\n\r\nisPermutation(\u0027abc\u0027, \u0027bac\u0027)","IsDeferred":false},{"Name":"every","Code":"const quickSort = (arr) =\u003E {\r\n if (arr.length \u003C= 1) {\r\n return arr\r\n }\r\n\r\n const pivot = arr[0]\r\n const left = []\r\n const right = []\r\n\r\n for (let i=1; i\u003Carr.length; i\u002B\u002B) {\r\n if (arr[i] \u003C pivot) {\r\n left.push(arr[i])\r\n } else {\r\n right.push(arr[i])\r\n }\r\n }\r\n\r\n return [...quickSort(left), pivot, ...quickSort(right)]\r\n}\r\n\r\nconst isPermutation = (a, b) =\u003E {\r\n if (a === b) {\r\n return true\r\n }\r\n\r\n if (a.length !== b.length) {\r\n return false\r\n }\r\n\r\n const sortedA = quickSort(a)\r\n const sortedB = quickSort(b)\r\n\r\n return sortedA.every((x, i) =\u003E x === sortedB[i])\r\n}\r\n\r\nisPermutation(\u0027abc\u0027, \u0027bac\u0027)","IsDeferred":false}]}