The technical interview was the first coding round of the second round, with 2 SDEs. It leaned more toward OOD. You're given a string stream of lots of items and have to process them into a receipt. There were four requirements: 1. Print the items one by one with each item's price, and on the last line the total of all prices. 2. Consolidate quantities by item type, for example three cheeses becomes "cheese, 3, price x3". 3. Add a buy-three-get-two-free promotion on a certain item, and adjust the price and item quantity accordingly. 4. Sort the items in alphabetical order.
The code for printing the receipts was already there, so basically the point of the question was to change the items variable in the shopping cart class from a list to a hashmap, and then rewrite all the methods like add item and remove item. You could use the AI window CoderPad provides, which had Opus 5. It was only 30 minutes, so it went fast. I didn't finish in the 30 minutes, and since I was rusty at writing Java by hand, I got rejected because of this.
Discussion
Loading comments…