Funny Bargain Algorithm - PDD (retired)
Description:
Pinduoduo (PDD) is a popular shopping app in China that offers a unique feature: invite friends to help you bargain for a product. If enough friends join, you could get the item for free! However, the chances of reaching 100% progress and getting the item for free are slim, even with a large number of invited friends (unless you are The Chosen One).
Here’s a typical progress chart:
Invited Friends | Progress |
---|---|
1 | 95% |
2 | 97% |
3 | 98% |
4 | 98.5% |
5 | 98.8% |
... | ... |
10 | 99% |
100 | 99.9% |
10000 | 99.99% |
... | ... |
The PDD function takes an integer input (0,2147483647), representing the count of invited friends, and returns a double output (0,1), representing the progress towards getting the item for free. The return value increases monotonically with the input parameter.
P.S.: The progress chart provided is just an illustrative example and does not need to be strictly adhered to.
Similar Kata:
Stats:
Created | Dec 6, 2023 |
Warriors Trained | 38 |
Total Skips | 5 |
Total Code Submissions | 55 |
Total Times Completed | 18 |
C# Completions | 11 |
JavaScript Completions | 13 |
Total Stars | 0 |
% of votes with a positive feedback rating | 61% of 9 |
Total "Very Satisfied" Votes | 3 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 8 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |