At which point we are doing back tracking

It seems a recursion problem unable to understand at which point we are backtracking. In your words where are we changing the cap ?

yes you are right ,we solved this using recursion just to understand how do we make a recursive call