Watch tutorials and explanations by expert teachers that walk through solving this problem.
Hua Hua
yeetcode
Fraz
Programming Live with Larry
Code Circle
Decode
CSE Unfiltered
ExtremeProgrammer
Solve more problems to master this pattern