Watch tutorials and explanations by expert teachers that walk through solving this problem.
Roel Van de Paar
Code Thoughts
Fearless Learner
ExtremeProgrammer
Developer Coder
DSA Solution
hornclause
codeplayjourney
Solve more problems to master this pattern