
Programming: Whiteboard Solutions – has12
A student asked me for help with a logic problem he was struggling with today that dealt with arrays and loops. The prompt was as follows: Given an array of ints, return true if there is a 1 in the array with a 2 somewhere later in the array. His initial attempt at solving the challenge was close, but he was missing one key component that many students of programming tend to struggle with initially. His initial code looked like this: His for loop looked good, he was properly