Skip to content

Latest commit

 

History

History
4 lines (3 loc) · 273 Bytes

MaxAndMinUnsortedArray.md

File metadata and controls

4 lines (3 loc) · 273 Bytes

I created two variables min and max, comparing them with the elements as I traversed the array. It is a single traversal so the time complexity is O(n).

The space complexity is also O(1) because the size of the array remains contants and only two variables are created.