8 kyu
Will there be enough space?
25,861 of 75,112user2514386
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Nice!
Прекрасная и простая задача для начинающих.
No fixed tests in NASM
hey mr, can you give me a single advice to become a solver problems.Thanks
nice one, thank you! :)
Haskell translation
approved
When you write
return cap - wait - on
it returns -10 for first test, how is that possible? The first test is 10, 5, 5. If you return them separately it returns exactly these values. But when you doreturn cap - wait - on
which should translate to10 - 5 - 5
it return -10.return cap - wait
returns 5.I think you read test results wrong. The first test passes, and it's marked ggreen. The -10 you see comes from the second test, which is
enough(100, 60, 50)
.Nice!
I almost fall of my chair when I saw an exercise with good explanation, example of input/output, and a full DOCUMENTATION for a single simple exercise, author of this KATA is a gem of out world.
Kotlin Translation
Forked and approved
Interesting challenge. Thanks!
Scala translation
Approved
test.assert_equals(enough(20, 5, 5), 0) why not 10?
Because:
With a capacity of 20 and 5 passengers on board, there is plenty space for the 5 new passengers.
Quite an interesting question
Hi, can someone help me. Why this code didnť pass tests everythink looks correct.. thx for help.
Which code? Read this: https://docs.codewars.com/training/troubleshooting/#post-discourse
It seems you're missing some
}
at the end.You've right. Missed } at the end. I did't see it :(. Thx.
Nice!
Nice Kata!
This comment has been hidden.
That's a problem with your code, not a kata issue. Use
question
label instead, read this, please: https://docs.codewars.com/training/troubleshootingRead the error message you get, your code has invalid syntax.
Very cool Kata !
This comment has been hidden.
Hi everyone!
Could you explain why this expression (test.assert_equals(enough(20, 5, 5), 0)) is 0?
This comment has been hidden.
Hello. I don't understand the i32 part. How would we even know to do that?
Definitely not 8
I like this one. I was thinking a little bit more for this simple task, but I did it. The most important here to make a logic first with using Math.abs method.
COBOL translation
approved
Crystal translation
R translation
(author long gone)
Not crystal, seems to go to CoffeeScript O_o
Anyways R approved awaiting CoffeeScript correction
Thanks to LearningFTW for the approvals ~~
Insta fav for documentation part in descrption.
This comment has been hidden.
Please mark your post as having spoiler content next time, your
extra
calculation is wrong.Great! Not sure how I missed that. And will do.
This comment has been hidden.
Not a kata issue, check the sample tests, your code is wrong.
Converted language-specific blocks into language-agnostic description
This comment has been hidden.
Output gets messed up a bit because by default it's not flushed between test cases in C, so logs from different test cases end up mixed together.
Change your printing statement to
printf("%i , %i , %i\n", wait, on, cap);
(note the newline, which forces flushing), or flush your output explicitly withfflush
, and logs should appear correctly.Thank you so much. But earlier i wrote a solution and was getting error, now the same code worked. When printed, i was getting some numbers with leading "0". Now it's fine. Thanks.
Please use new python test framework.
how do i fix None..test case always says...None should be equal to 0
The expression (enough(100,60,50)) == (10) is false. <--- This is the message I keep on getting after a Test. I was thinking that should be correct :). Any help?
Why?
sorry. I actually misinteprated the error message and fixed the problem. Thanks for trying to help
This comment has been hidden.
C++ Translation added :)
This comment has been hidden.
Your code is wrong, that's not a kata issue, please read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution
hi, how is it that the cap is 20, 5 people on board. and 5 people waiting. answer should be 0?
Not a kata issue.
It's the same as first example in description - all passengers will fit.
This comment has been hidden.
cap = 100 , on=60 , the test says I can get only another 10 people.... if I do the math it is 40 ...
The test says that ten people are left out! Read the problem again.
༼ つ ◕_◕ ༽つ
indeed!! my sherlock went to sleep haha, thank you.
Prolog translation
This comment has been hidden.
Fixed the description to narrow down possibility of interpretations.
For C
Very minor issue of tests generating a warning:
its the same for me, why?
I excluded all the passengers not wearing masks, and it solved.
test.assert_equals(enough(20, 5, 5), 0)
what is this test even? why is expected result is 0? thats in python not the only test that needs fixing actuallycap is 20, there are 5 people already on, and 5 waiting to get on. Why do you think the tests are wrong?
so there will be 10 people total on a bus. Remind me whats the cap again?
^ That, also in the kata's description. Short for capacity I guess.
Can u stop trolling and fix it? xD
There is nothing to fix, unless you can prove there is. ;)
Cap is 20, 10 people on board(eventually), how the hell are there 0 spaces left? There is same issue for some hidden tests as well
You're confusing what you need to return, it's not how many spaces are left, it's how many people can't fit in the bus. Check the example usage in the description (I feel a deja vu).
I'm an idiot, cheers xD
Don't worry, sometimes it's a matter of reading the description a couple of times until it clicks, cheers.
Racket translation
'alr approved some time ago'
Shell translation is available.
PHP translation kumited.
Approved.
Add a test case which is cap = 100,on = 50,wait = 40. The value return should be 0.
Already added a similar fixed test to all languages in the sample and final tests.
This comment has been hidden.
Fixed.
There are tests with greater
on
thancap
in all languages.This image comes to mind:
Fixed for Python, Javascript, TypeScript and Java. The other languages still need fixing: C, C# and Lua.
lol that image
Ran into this in C just now
Ran into this in C#, though they can make an argument that it simulates typical public transportation in rush hour
Fixed in Lua and C#
Ruby translation kumited.
Please review and approve.
Approved
Thanks.
This comment has been hidden.
Yes, read the instructions again and try some tests like this one:
enough(20, 5, 5)
what is your code returning?Got it, thanks dude
https://www.youtube.com/watch?v=6CXiB5n883I
Here, take this TypeScript Translation :)
Failing on test 14 in C. It says something like "The expression (enough(r1,r2,r3)) == (eno(r1,r2,r3)) is false".
Anyone know what this means?
Your code is wrong.
Not an issue~~ use question tag~~
Fixed tests should check for negative number in the answer. At the moment it is being checked only by the random ones, which allows wrong solutions to pass sometimes
There are five languages, which one are you talking about?
Oh, sorry, I thought I wrote it. I'm talking about Java.
Done.
Please add test for if there is space left in Java code;
This comment has been hidden.
Not a kata issue:
Is the number of passengers going to be less than the avalible space? (example) cap: 14 on: 7 wait: 4
if so then what should I return?
This comment has been hidden.
The expression (enough(r1,r2,r3)) == (eno(r1,r2,r3)) is false.
what does it mean ??
This seems like it is an older resolved issue, if it isn't raise it with more detail :
-copy and past any messages -note the language
etc..
HOLAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!!!!!!!!!!!!!!!!!
Hola.
I made a C# translation for this Kata.
Keep in mind that the description for kumite doesn't properly show CW markdown, to see what it should look like simply fork the translation and view the description.
Already approved
In C there's a test:
846930886 1804289383 1681692777
. These numbers don't look like numbers of passengers at all. If it's considered a valid input then input range should be specified, otherwise this test should be removed.Fixed. Now all the arguments are clamped to range
0 to 1999
.Approved
This comment has been hidden.
This is a question
Yeah, sure.
And that is not an answer.
Ok, now instead of returning
True
, you have to return0
because the driver can take all passengers, so there is none remaining.You might want to add at least a slight twist on this exercise. As it is, it's almost purely arithmetic. Even for a kata of 8 kyu, it seems a bit light on language features.
This is a suggestion
In the second example:
The capacity is 100, there are 60 people on the bus and 50 are waiting. It's clear than the bus driver can take 40 people, (60 + 40 = 100). Why does it say that 10 is the answer?
Hi raulbc777, the description says:
In this case the bus can't take 10 passengers.
Regards,
suic