3 ms·
This was part 1 of a 2 or 3 part question. First we literally iterate through each element, keeping track of the max. I use this question for interns, too, so i
by LargeTomato 3y ago
This was part 1 of a 2 or 3 part question. First we literally iterate through each element, keeping track of the max. I use this question for interns, too, so it's intentionally super easy. It gets harder in part 2.
For clarity, the pseudo code solution to the question is
for row in a[0]:
for e in row:
max_so_far = max(e, max_so_far)
return max_so_far
No tricks. Just an initial weeder question for interns before we move onto the real question.
- filoleg 3y agoAh, makes perfect sense, thank you for clarifying. Your pseudo code solution confirms that I understood the problem statement correctly. Out of pure curiosity, what were the follow up (part 2 and 3) questions? Not looking for a solution, but if you could post the problem statement, it would be very appreciated. If you feel uncomfortable sharing it publicly out of some concern, that’s entirely fair, no worries.