Watch tutorials and explanations by expert teachers that walk through solving this problem.
Algorithms Made Easy
Aryan Mittal
NeetCodeIO
Programming Live with Larry
Algorithms Casts
Programming Live with Larry
Algo Horizon
Brute force
Think-Twice-Code-Once