7 kyu
Ones and Zeroes
340 of 377saudiGuy
Loading description...
Algorithms
Strings
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.
Lua translation!
.
Haskell translation
.
Testing for '000101100' True should equal False i think should be True
A leading zero always results in a False outcome.
Rust translation
Approved.
fuck, I misclicked... Wanted to approve to 7...
fixed
👌
ok, almost good but...
issue:
suggestions:
x + '1'*randint(...)
(or maybe just replace a with this?)Added in description + a little change in random tests as per my understanding. :-/
the
a
case has rather low interest (it's trailing 0s after valid ones), the case I suggest could spot some invalid regex solutionsdone.
Every consecutive sequence of ones is immediately followed by an equal-length consecutive sequence of zeroes.
Either
P.S. fixed tests should include cases like this.
updated description
I think this specific test should aslo be added, and the random generator should be tweaked so that it can generate those specific inputs ('0', leading '0' with following valid sequences of 1s and 0s, "apparently valid" sequences of 0s then 1s which are invalid (like 0011000111))
added sample test cases + random tests will be generated as per your requirment now.
Hi,
missing fixed test:
"0"
cheers
added
corrected now.
It should be False. I didn't get your issue.
Isn't every group of
1
followed by a group of0
of same length? My currently valid solution also returns True for this.It's a lack of specification and/or testing for the leading 0s. One of those should not pass :
I don't see anything in the description tackling the point above. => ? (also, both are still valid /Edit: might be a cache issue, tho)
Description needs to further restrict the input: it is a string that contains only
1
and0
. It currently doesn't rule out the possibility of having other characters in the input.added.
Reference solution doesn't match description for a case like
00110100001111
added sample + random tests for this
In random tests:
It should be False.
Yes, the ref sol is completely wrong
corrected + a sample test for this.