I am trying to solve a question for interview preparation. I am struggling to find the right data structure and logic to solve this.
The question is as follows
There are inputs array of the format: ["date, item"]. For example:
[["10212021", popcorn], ["10222021", popcorn], ["10212021", soda],["10212021", popcorn],["10212021", soda]]
On the same day if there are popcorn and soda both purchased, then it costs 9 dollars as a bundled price. else soda is 2.5 dollars, popcorn is 8 dollars.
You need to calculate the total price based on these criteria and return that as output.
My initial train of thought
I am a beginner in JS please advise.