Sabermotamedi / RihalCodeStacker-Backend

This Repository is related to the Rihal Backend Challenge.
MIT License
1 stars 0 forks source link

Implement an API for users to purchase and award stars to movies #23

Open Sabermotamedi opened 5 months ago

Sabermotamedi commented 5 months ago

Is your feature request related to a problem? Please describe. Imagine a star system where users can purchase stars to award to movies as a gesture of excellence and appreciation. Construct an API where the user can get the minimum number of stars to award given movies (API should expect a list of movie IDs). Put the ratings in an ordered list (exact order given by the user), stars will be given to these movies based on the following requirements:

Each movie must have at least one star. Movies with higher ratings get more stars than their neighbours. Return the minimum number of stars the user needs to have to distribute the stars to the moivies.

For example: Movie ratings = [2,1,2] should return 5. Movie ratings = [10,1,2,8,7,3] should return 11.

Describe the solution you'd like