6 kyu
SMS Lottery Bet Validator
411 of 818anter69
Loading description...
Algorithms
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.
This comment has been hidden.
the numbers must be unique :D
Well, these two things cannot both be true.
In the future, only post as an
issue
if you can prove a problem with the kata, otherwise post as aquestion
.Thank you MrPancake, I don't know English very well and sometimes it's difficult for me, the translator sometimes translates wrong! I was able to pass one more random test, the last one remained. Bro thank you!
rowcased sorry bro, it's my misstake!
I did thanks guys!
JavaScript:
what makes the string invalid here ?
was this test a random one ?
given [n, m]
n the expected length
m the maximum value
to me the string is valid
Yes, I tried further, the JS random tests sometimes generate inputs like:
([3, 3], "1,3 2")
whereN == M
, and expectnull
, even though nothing seems to contradict the specifications here: there areN
unique numbers between1
andM
, separated by spaces and/or a commaAfter a couple attempts I managed to submit, this is likely a kata issue
JS translation removed
Who can describe me what with that sequence is not OK? -(-_-) Test Failed Expected: null But was: < 4, 5, 10, 32, 35, 42 >
fails this test. I don't understand what's wrong --->>>
Unhandled rejection TestError: too much numbers and number greater than 'm' - Expected: null, instead got: [5, 18, 19, 22, 27, 32] Unhandled rejection TestError: too much numbers and number greater than 'm' - Expected: null, instead got: [5, 18, 19, 22, 27, 32
JS translation removed
Ruby random tests
./spec/solution_spec.rb:32:in
solver7879': undefined method
to_set' for [1, 28, 33, 37, 47, 51, 61, 73]:Array Did you mean? to_s (NoMethodError)Random tests from fail without require 'set'. In this case, the set is not needed in the solution, and all solutions from the list of solutions do not pass.
fixed
thanks
It seems like the python version of this kata is missing test cases for invalid characters that are not digits, spaces or commas.
The python version already generates input with invalid separators, and there are a few such fixed tests too.
Ruby 3.0 should be enabled, read this to learn how to do it
Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)
fixed
Found a random test case with bad result expected (in Javascript translation), according to description and other fixed and random tests expected results:
[6,6], "3 , 2 5 ,4 1,6"
expectnull
... anyway, attempting again to not encounter this case let pass the kata ^^
Yes, I had one too!
Got almost the same problem: [3,3], "1 2 3" -> null Expected: null, instead got: [1, 2, 3]
Same, I had to relaunch the test until this one was not called
JS translation removed
C#
0
is not OK according to the description.45
is bigger thanM = 44
. It should return null.See my issue report below:
The Expected and But was were exchanged.
See my issue report below:
The Expected and But was were exchanged.
.
Ok. You are right :)
C# The
Expected
andBut was
were exchanged. When I submit a solution likereturn null;
, I got the following result:You are right. I will look into fixing that.
Edit: Updated translation submitted.
C# translation approved. Please check and give feedback if it's OK now.
No computer to test ;-)
Some edge cases to think about:
,1 2
,1 2[space here]
(I'm not sure if they are considered valid or not);1\t2
,1 2\n
;1 ²
(or1 \u00b2
since Codewars has problems with Unicode in Python);+1 +2
.Thanks for the suggestions!
Considering
\t
and\n
would be quite right but they can be in an SMS. I can definitely type a newline on my phone,\t
is standard ASCII so I think with the right device you can type it too. And it looks like the charset of SMS with non-ASCII characters is UCS-2, so²
is technically possible too.Well, I didn't update it until now, so I will leave the kata as is (in order not to invalidate all current solutions + update the translations...) Next time I'll be quicker.
edit: description updated
JS translation kumited.
; ) )
Sorry, I can't approve it, because I updated the description in the meantime... Please submit your translation once again. Should I reject the current version first?
Cheers
re-kumited (with updated description)
; ) )
Thanks, translation approved! :-)
Please see JS issue above.
I added a C# translation. I pretty much ported over the Python tests exactly, except there are two new fixed tests to overcome the issue Blind4Basics mentioned.
Translation approved! I hope it's as good as the original :-)
Cheers
Hi,
You should add fixed tests like these (my first solution slipped through the tests):
I already had similar examples, but added yours, too (it doesn't hurt ;-)
Cheers