You are given an array of integers. Return the largest value.
This is the simplest linear-time problem. You cannot do better than O(n) because every element could be the answer. Before solving, think about what operations happen inside the loop.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
(Analyzing linear scan)
You are given an array of integers. Return the largest value.
This is the simplest linear-time problem. You cannot do better than O(n) because every element could be the answer. Before solving, think about what operations happen inside the loop.