Watch tutorials and explanations by expert teachers that walk through solving this problem.
Bradley Allen
College Wallah
NeetCode
ThePrimeTime
NeetCodeIO
Wisdom Dream
Prep Insta
R Sai Siddhu
Solve more problems to master this pattern