Watch tutorials and explanations by expert teachers that walk through solving this problem.
Greg Hogg
NeetCodeIO
Happy Coding
Eric Programming
if else statement
Programming Live with Larry
ByteQuest
Sleepy Cracker
Solve more problems to master this pattern