• + 1 comment

    Yes and this approach is actually O(n) unlike some comments above who have achieved this in O(n^2)