Watch tutorials and explanations by expert teachers that walk through solving this problem.
NeetCodeIO
if else statement
Leet Logics
Programming Live with Larry
Developer Docs
The CodingBuddies Guild
CodingNinja
Code Harmony
Code with Bogus Engineer
Solve more problems to master this pattern