18th Parallel interview question

Test cases for real time scenario