Grading policy: 8 marks for correct algorithm. Deduct 2 marks if the running time is more than O(n) (except sorting). Deduct 2 marks if space complexity is more than O(n). Deduct 2 marks if the code is written in such a way that it will not work for some inputs or something is hard-coded. 4 marks each for correct output of test cases (8 marks in total) 2 marks for indentation (total 2 marks) 2 marks for comments (total 2 marks) Total marks: 20