{"ScriptPreparationCode":"var arr1 = [];\r\nfor(let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n arr1.push(Math.floor(Math.random() * 5000));\r\n}\r\nvar arr2 = arr1.slice(0);\r\narr2.sort((a, b) =\u003E a - b);","TestCases":[{"Name":"Unsorted","Code":"var toSort = arr1.slice(0);\r\ntoSort.sort((a, b) =\u003E a - b);","IsDeferred":false},{"Name":"Sorted with check","Code":"var toSort = arr2.slice(0);\r\nlet lastEntry;\r\nlet isSorted = true;\r\nfor(const entry of toSort) {\r\n if(lastEntry != null \u0026\u0026 entry \u003C lastEntry) {\r\n isSorted = false;\r\n break;\r\n }\r\n lastEntry = entry;\r\n}\r\nif(!isSorted) {\r\n toSort.sort((a, b) =\u003E a - b);\r\n}","IsDeferred":false},{"Name":"Sorted without check","Code":"var toSort = arr2.slice(0);\r\ntoSort.sort((a, b) =\u003E a - b);","IsDeferred":false},{"Name":"Unsorted with check","Code":"var toSort = arr1.slice(0);\r\nlet lastEntry;\r\nlet isSorted = true;\r\nfor(const entry of toSort) {\r\n if(lastEntry != null \u0026\u0026 entry \u003C lastEntry) {\r\n isSorted = false;\r\n break;\r\n }\r\n lastEntry = entry;\r\n}\r\nif(!isSorted) {\r\n toSort.sort((a, b) =\u003E a - b);\r\n}","IsDeferred":false}]}