ABC interview question

based on linked list and dsa