Coding interviews are always for me an opportunity to learn and grow which is why I wanted to share you my thought process for this one I found this morning at
I was happy to find out it was ruby
It was too good to be true. So you have two choices:
- either you go follow one by one the id chain
- or you can just write a bit of function like I did
You could have go for an iterative version with a loop
I guess at RainForest they will have to make a new test since you know the answer for this one.
Overall I think it way simple enough. We just needed to take each problem one at the time and yeah every beginner can do it too.