Watch tutorials and explanations by expert teachers that walk through solving this problem.
Ujjval Codes
SuperCode
Math Geeks
ContentForGeeks
Programming Live with Larry
LetsCode
LeetCode The Hard Way
ExtremeProgrammer
DKodeTree
Solve more problems to master this pattern