Watch tutorials and explanations by expert teachers that walk through solving this problem.
NAGE FOREX
NeetCode
Umar Ashraf
take U forward
Tushar Roy - Coding Made Simple
Greg Hogg
Techdose
Solve more problems to master this pattern