Watch tutorials and explanations by expert teachers that walk through solving this problem.
Greg Hogg
Top SWE
Everyday Data Science
Data Science University - MLV Prasad
Leetcode Mate
Jar On Me
Solve more problems to master this pattern