3 ms·
give me a break, it does O(n^2) work to verify that the response is sorted and contains the same values.
by blt 12y ago
give me a break, it does O(n^2) work to verify that the response is sorted and contains the same values.
- anon4 12y agoThis can be improved. The following should be sufficient: 1. check that the list is the same size 2. for every element in the original, do a binary search in the new list; fail if not found 3. check that the element following the element you found is greater than it This should make it run in the time it takes to do a binary search times the list size, or O(n * log n)