#Hey Guys ๐ ,
1 messages ยท Page 1 of 1 (latest)
more efficient as in big O? Unless there's some special restriction on the input (sorted, etc), then no. At minimum you at least need to look at every value in the list, which is O(n) time, and your solution is also O(n).