3 ms·
You can use a binary search to make the lookup even faster. There's no need to iterate over all possible lengths.
by mark-r 7y ago
You can use a binary search to make the lookup even faster. There's no need to iterate over all possible lengths.
- PaulHoule 7y agoI'm not sure that you come out ahead with binary search over n=10 given branch prediction issues. You'd have to test it to really know.