Watch tutorials and explanations by expert teachers that walk through solving this problem.
Alpha-Code
LeetCodon
Luc Taylor
Bear with me
CP Geeks
Roel Van de Paar
Lulu Code
Code Broski
LetsCode
Solve more problems to master this pattern