How can I traverse an array from both sides at the same time?
01:42 21 Jan 2020

How can I traverse an array from both sides at the same time, stopping after the traversals meet in the middle, while maintaining the time-complexity of O(n)? I am using Java in my case, but you can provide a solution in any language.

java arrays algorithm