3 ms·
Got me to laugh too! I thought I was clever with my O(n) solution. Let A be the original array and let B be the sorted array. Just loop through A and assign B[A
by abnry 7y ago
Got me to laugh too! I thought I was clever with my O(n) solution. Let A be the original array and let B be the sorted array. Just loop through A and assign B[A[i]] = A[i].
But this is still dumb! lol.
- BubRoss 7y agoIt says from 1 to N inclusive, so each offset would need to have 1 subtracted from it. (Yes I realize it would just be an iota function in c++)