To find the maximum, what's the standard pattern?
<code>int max = ?; for (int i = 0; i < arr.length; i++) if (arr[i] > max) max = arr[i]; </code></pre>
- A
max = -1;
- Bcheck_circle
max = arr[0]; (start from i=1)
- C
max = 0;
- D
max = Integer.MAX_VALUE;
Explanation
Initialize to first element; then iterate from i=1 (or all and skip first compare).