Update the maximum and minimum values during traversal
for arr in arr : NEW_LINE INDENT if arr > max : NEW_LINE INDENT maxCount += 1 NEW_LINE max = arr NEW_LINE DEDENT if arr < min : NEW_LINE INDENT minCount += 1 ; NEW_LINE min = arr NEW_LINE DEDENT DEDENT print ( " Number ▁ of ▁ times ▁ maximum ▁ " , end = " " ) NEW_LINE print ( " value ▁ updated ▁ = ▁ " , maxCount ) NEW_LINE print ( " Number ▁ of ▁ times ▁ minimum ▁ " , end = " " ) NEW_LINE print ( " value ▁ updated ▁ = ▁ " , minCount ) NEW_LINE