So I was reading an article where the person was talking about the internship interview process and in it, the person was asked 2 algorithm related questions. I decided to solve them myself and see how I would approach such a problem.
Here is the problem — you are given an array of integers [1,2,1,3,3] and you want to find:
- The first consecutive recurring number. Then answer of this will be 3.
- The first recurring number in the array. The answer of this will be 1.