Approach explanation ( •̀ ω •́ )✧
- I started by setting both min_val and max_val to the first element of the array.
- I went through each element in the array.
- If I found a smaller element, updated min_val.
- If I found a larger element, updated max_val.
- At the end, I had both the minimum and maximum values in one pass.
Methods used: (〜 ̄▽ ̄)〜
- Single traversal method
- Comparison updates

Top comments (0)