Onsurity interview question

Leetcode problem statement : Rabbit in Forest