this question can be done in a iterative method as well using bfs easily then why is recursion used to solve it.
hello @Parmeet-Kalsi-1631789033630118 it is upto u . u can try any method to solve this problem