Algorithmic Crush
I was working on a problem on HackerRank called Algorithmic Crush (now titled “Array Manipulation”) and I thought the efficient solution was interesting and worth sharing. Problem You are given the size of a 1-indexed array and a list of operations to perform. Perform each operation on the array and return the maximum value in the array after all operations have been completed. Let’s go through an example. Our example array has 8 elements (represented by n) and we are going to perform 3 operations on the array (represented by m)....