Amazon interview question

Backtracking for both LC style questions