Why is this time complexity O(n)?
The code iterates through n^2/2
(half a square matrix) locations in the array, so its time complexity is O(n^2)
The code iterates through n^2/2
(half a square matrix) locations in the array, so its time complexity is O(n^2)