Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yasindce1998/rate-my-plate
Coding Problem
https://github.com/yasindce1998/rate-my-plate
Last synced: 25 days ago
JSON representation
Coding Problem
- Host: GitHub
- URL: https://github.com/yasindce1998/rate-my-plate
- Owner: yasindce1998
- Created: 2022-09-16T14:49:12.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-16T14:54:41.000Z (over 2 years ago)
- Last Synced: 2024-06-20T22:28:27.896Z (7 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rate-my-plate
**Coding Problem:**\
A restaurant keeps a log of (eater_id, foodmenu_id) for all the diners.
The eater_id is a unique number for every diner and foodmenu_id is unique for every food
item served on the menu.
Write a program that reads this log file and returns the top 3 menu items consumed.
If you find a eater_id with the same foodmenu_id more than once then show an error.Expected output:
1. Code that can handle the above problem statement\
2. Testcases (with example log files) that checks all the possible conditions\```
git clone https://github.com/yasin-cs-ko-ak/rate-my-plate.git
cd rate-my-plate
go run rate-plate.go
```
Output:
```
➜ rate-my-plate go run ./rate-my-plate.go
Successfully Opened log.json
----Top 3 FoodMenuIDs----
FoodMenuIDs: 236 Count: 5
FoodMenuIDs: 233 Count: 4
FoodMenuIDs: 235 Count: 3
Error EaterID: 001 has FoodMenuID: 233 more than once
Error EaterID: 002 has FoodMenuID: 234 more than once
Error EaterID: 003 has FoodMenuID: 236 more than once
```