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