7 kyu
Counting Valleys
845 of 1,887Valefar
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.
Nice Kata, really enjoyed solving this. Thanks to everyone who contributed to it.
The sample tests in python are not running.
They are running, and your code passes them. Copy your code, click reset, paste your code back in, and try again.
Ruby Translation
Lua translation
Cool as hell how many diverse solutions there are for this kata. It was a fun one, thanks!
C Translation
approved
RISC-V translation Kumited - please accept :-D
Approved
Rust translation Kumited - please accept :-D
Approved
C++ tests generate warnings.
Fixed
it is not 7 kyu even that kata was too much for 7 kyu: https://www.codewars.com/kata/5bbb8887484fcd36fb0020ca/train/python and it's only a fraction of this kata
but the kata itself is great
This comment has been hidden.
Read the description again, that's the easiest example of one valley.
Roger that - Thanks!
challenging for a 7 kyu kata, this one's a bit on the 6 kyu side! was fun!
Python translation:
https://www.codewars.com/kumite/5e9599ecc782ea00233c41ea?sel=5e9599ecc782ea00233c41ea
Has anyone completed this in javascript ? I return 1 in UFFDDFDUDFUFU in this case and it doesn`t pass.
Are you sure you're returning 1? JS works for me fine.
Maybe you could post your code and someone could have a look.
This comment has been hidden.
Haskell translation
Approved
It would be a good thing to get your test headers correct ( no fixed tests under a "random" header ), and their indentation as well.
This is a bit of a mess to read, which makes it hard to see if it's correct and I'm satisfied with it.
ETA: The first two fixed testcases are identical, which is not very useful, and the example testcase is not the one from the description. ( Imagine: You write a glorious solution, expectantly hit
Run Sample Tests
, and .. fail. :/ ( insert some choice words here. ) I'd then be looking at the description to see where I went wrong; it had this nice step-by-step explanation of .. oh wait. )test headers fixed
You can use
equal
instead ofstrictEqual
to compare primitives.For what a reason?
No you can't.
assert.equal
uses non-strict equality (==
), so"0"
would be tested equal to0
.strictEqual
is correct for primitives ( anddeepEqual
is correct for most objects ).Hi,
Your fixed tests are missing (at least):
And it would be better that the fixed tests have hardcoded results, rather than relying on your solution (that can avoid some mistakes when the kata is translated).
cheers
Thank you for response, For DFFFU test will return 1 For UFFFD, DFFFD, UFFFU tests will return 0 Now, tests have fixed results
errr, you misunderstood what I meant x)
I was sying to build inputs with various results, but containing those short sequences, not the sequences isolated! x)
I will appreciate if you write in code(here) what you meant
something like
"UUFFFDFFFDFFFDFFFDFUUFFFDFUFFFUUDDFFUFDDFFFUFFU"
Why DFFFU gets as a result 1, if its pretty much the same as UFFFD?
Thanks!
The first case you go below 0 level and the other you don't.