For Q2 there was not enough time to code it so I explained the O(N) time and O(N) space solution. To which he said an O(LogN) space solution also exists.
Round 2
LLD of Vending Machine
Was asked to directly code the objects and methods (method implementation not required)
I started with showing flow and identifying objects and methods in notepad first, then went to create then in IntelliJ.
In my opinion, I did good, but the interviewer wanted design pattern to be used, and I hadnt used any.
I explained we can use CoR in calculating the Cash amount.
(Later I checked LLD of Vending Machine , everyone implements using some state Management Design pattern)
I was not using that design pattern but managing the state in a different way.
She asked how will I handle concurreny in this problem(or other problem in general), before I could answer she jumped to "How many design patterns you know about can you explain a few", I explained a few.
She then said this vendingMachine class can be a singleton. (I find singletons pointless unless we have code to create an object at multiple places but we only need 1 instance)
Overall Interviewer was pretty uninterested. She left the interview 2 times to get Coffee.
Design rounds are supposed to be a discussion. Whenever I tried to discuss, she was like "code it first, else we might not get time at the end"
Rejected at the end.
Compensation was 36LPA (no Joining Bonus or Stocks).