
Find the Maximum and Minimum Element in the Array
via Dev.toSaranya R
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
Continue reading on Dev.to
Opens in a new tab
7 views



