Watch tutorials and explanations by expert teachers that walk through solving this problem.
NeetCode
NeetCodeIO
Code_PMR
CodeCake
Bayu Aji
Algorithms Casts
Code Coder
Solve more problems to master this pattern