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.
I'm trying to solve kata in Haskell. According to output from random tests my code fail on strings like "\na", "a\n", "a\t". if i understood everything correctly, this strings should be returned as is or i'm wrong? Tests do not show expected results. I tested code on local mashine and it works fine on those input.
thanks so much!, embarassing mistake
It looks like you're not returning any value. Printing is for your own debugging.
Hi there!, can someone share some light on this:
Test Results:
Fixed Tests
Basic Test Cases
Log
'ehT kciuq nworb xof spmuj revo eht yzal .god'
None should equal 'ehT kciuq nworb xof spmuj revo eht yzal .god'
Log
'elppa'
None should equal 'elppa'
Log
'a b c d'
None should equal 'a b c d'
Log
'elbuod decaps sdrow'
None should equal 'elbuod decaps sdrow'
I'm wondering what I'm doing wrong, they are strings, i get the correct output respecting the spaces....hmmm
They are there. I checked.
in python when i reset to restart coding there is no sample tests.
Your solution ends with a space. There shouldn't be a space at the end.
Not a kata issue.
Why?
Test Example
should work for sample test cases
Expected
to equal
Completed in 0.6589ms
I am curious as to what language you attempted this in. I did it in C++ and it only took about 25 minutes to figure out, and the only edge case I had to deal with was a string that was all spaces.
I would also argue that dealing with edge cases is teaching how to write code, as dealing with edge cases is a major part of programming.
@andreyvdl please mind that the fact that someone points out to you that you used the ISSUE label incorrectly is not abuse, and reporting such behavior as abusive is not right.
Having sauid that, Nuno is right: your solution has a bug, performs out-of-bounds access, and triggers undefined behavior. Your code does not handle leading spaces correctly, and it crashes for cases like
" "
or" test"
, with a space at the beginning. You need to fix your code.Your code very likely contains undefined behavior. Also, "works on my local machine" is not a valid kata issue report. See https://docs.codewars.com/training/troubleshooting#post-discourse.
This comment is hidden because it contains spoiler information about the solution
OP solved it, closing
You are absolutely right! Thanks to both of you!
As hobovsky guessed, where is the nul terminator going to be stored ? ;-)
Loading more items...