Watch tutorials and explanations by expert teachers that walk through solving this problem.
NeetCode
ThePrimeTime
Greg Hogg
The Code Skool
NeetCodeIO
Bradley Allen
Timothy H Chang
Cherry Coding [IIT-G]
Solve more problems to master this pattern