4 ms·
This 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
by anon4 12y ago
This 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)