Algotec interview question

1.write code that remove spaces from string and split it by ',' to array in O(n) 2.why the destructor should be Virtual (ans : to clean all the memory we created by sub class) 3.design 2 options of undo function for drawing page (ans : 1. faster but use more space - save each time the whole screen 2. less space but slower - save each time the last metadata of ecah object) 4.some probelm about not having copy cunstructor (use the default one - cause problem sometime - not allocate memory as we tought and might crash). 5.Factory pattern design. change from many "if" to factory design. (ans : Factory design and each time just add to dictionary and dont need to cahnge code)