This solution uses just iterating all possible cases. Next time, I'll use the approach of Hash Map. Thank you for watching video.