Watch tutorials and explanations by expert teachers that walk through solving this problem.
Ren Zhang
Ozone Project
CodeInsanity
Programming Live with Larry
Algorithms for Big Bucks
Fearless Learner
Tim Huang
ExtremeProgrammer
An Average Programmer
Solve more problems to master this pattern