Watch tutorials and explanations by expert teachers that walk through solving this problem.
Ashish Pratap Singh
NeetCodeIO
Aryan Mittal
ChunkCode01
Code Ninja
Programming Live with Larry
CodeFod
Solve more problems to master this pattern