In this lecture, we cover key array traversal patterns in Kotlin: iterating by elements and by indices (
indices), computing sum and average, counting elements by a condition, searching for a value with an index return (
-
1 as “not found”), and finding the maximum and the maximum together with its index. At the end, we review typical mistakes (integer division, incorrect accumulator initialization, wrong index boundaries, and loss of readability).