Watch tutorials and explanations by expert teachers that walk through solving this problem.
NeetCodeIO
Learn With Chirag
Endeavour Monk
Coding with Ankita
Alpha-Code
Programming Live with Larry
Code Crusaders
Solve more problems to master this pattern