added approach/debug statements to analyze O(n)