I bombed my interview after I got this OOP question from a company. Can one of you experts help solve this using Python? I had used switch cases (using python dictionary) to solve this problem without OOP.
Original string: abcdefghijklmn
Operations:F -> move curser forward, B -> move curse backward, R -> replace char
Operation string: F2B1F5Rw -> abcdefwhijklmn (expected output)
Moving forward by 2 chars, move backward by 1 char, move forward 5 chars, replace 1 char to be ‘w’
We can assume that curser is at first character at the beginning. How can I add more operations using OOP if required?
But apparently the interviewer wasnt too happy with my switch case approach, and as a follow up asked me to solve the problem using OOP. Any ideas how I could solve this without switch cases? A better approach using OOP principles or perhaps a better Data Structure I am not aware of?