Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
.
Much easier than what you thought. See the next numbers of the series: 1/1, 1/4, 1/7, 1/10, 1/13, 1/16. Don't you see a pattern there?
I agree with you. I don't even know how this works, so how are we supposed to code it ???
Is it like 1/(1^1) + 1/(2^2) + 1/(3^3)... nop
Is it : 1/1 + 1/(1+2) + 1/(2+3) nop...
not even prime numbers, so what ??
This comment is hidden because it contains spoiler information about the solution
I would reinforce that the goal of the program is to find denominational change rather than numerical change. Maybe add a specific example to clarify further. Something like:
"Be sure to count change by denomination. For example [25, 25, 100] will result in 'NO' because you cannot make 75 with 2 25 dollar bills"
Or you could always extend your current example explanation to say:
"NO. Vasya will not have the right combination of bills to give change for 100 dollars"
That's what the examples are for:
tickets([25, 100]) // => NO. Vasya will not have enough money to give change to 100 dollars
But what text do you suggest to add in the instructions anyway?
I'm completely aware of the logic and the math associated with the second interpretation, hence why I actually laid it out to show the expected outcome in my initial question. What I'm saying is it needs to be clarified in the description whether it is to be programmed via denomination or numerical value. Many times the 'logical assumption' has been completely thrown out the window when it comes to challenges on codewars, which means every challenge should lay out exactly what it is asking for, not expecting the coder to make an assumption. It seems to be an issue that a few people are misunderstanding as they try to work it out, myself included.
You can't break a 100 bill to obtain a 25 or a 50 bill. So the only logic interpretation is the second one.
Let's review your math in the first case:
One customer gives you a 25 bill, you have only one of them.
Second customer gives you another 25 bill, you have two of them now.
The third customer comes with a 100 bill, you have not 75 dollars (only 50 in two 25 bills), so the answer is NO.
If you're selling tickets unless you didn't sell any, you can't end with no bills.
Thanks for clarifying, but that statement in no way specifies which of the two senarios would play out. I interpreted that statement as "you don't have to worry about 5 dollar denominations or 10 dollar denominations" not "count bills instead of numerical value"
So... it is an issue and leads to lots of misunderstanding when testing, as it seems to have based on the 'suggestions' tab that I just read.
It's not broken. And you should return No, I'll explain why:
[25, 25, 25, 25, 25, 25, 25, 50, 50, 50, 100, 100, 100, 100]
For the 3 50 bills you have to return 3 25 bills (then you have 4 25 bills left)
For the 4 100 bills, you need 4 50 bills and 4 25 bills (or 3 50 bills and 6 25 bills) and you haven't enough.
Don't mark that as a kata issue, it's not. The correct interpretation is the second one, it's clear in the kata description:
Each of them has a single 100, 50 or 25 dollars bill
Another issue: is the change to be given back per numerical value or per each received dollar bill? For example:
[25, 25, 100]
The above would evaluate 'YES' if you were counting only numerical value. Starting is $0, then you have $25, then you have $50, then you have $75 (from the $25 from the 100) and you give back $75 as change. Your final total is $0.
The returned log would be:
0
25
50
0
'YES'
The above would also evaluate as 'NO' if you were counting actual bills. Starting is $0, then you have a $25 bill, then you have 2 $25 bills, but when the guy with the $100 bill comes in, you can't break it with your current bill set, therefore, you can't give him his change of $75.
The returned log would be:
0
25 - 1
25 - 2
'NO'
test nine is broken how is it expecting no if theres enough change to return
i don't get it my python code passes all test but the last one
wtf kind of series is this goes from 1 to 1/4 to 1/7