Watch tutorials and explanations by expert teachers that walk through solving this problem.
vanAmsen
Algorithms Made Easy
ExtremeProgrammer
HowToLeetCode
LeetCoder
robzingcod
Solve more problems to master this pattern