Rithum interview question

How to solve different tasks