Watch tutorials and explanations by expert teachers that walk through solving this problem.
Mark Rober
TED-Ed
Simply Logical
Tushar Roy - Coding Made Simple
Gaurav Sen
GeeksforGeeks
Back To Back SWE
Pepcoding
Hua Hua
Solve more problems to master this pattern