7 kyu
Sort by Last Char
4,937 of 10,044PG1
Loading description...
Fundamentals
Strings
Arrays
Sorting
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.
What's wrong with this kata. I have the same output in codepen, jsbin, in console, but codewars output is something strange. Please fix the tests
your code is super wrong and failed the tests. what is there to fix?
super wrong. are you joking? put my code in any browser and you get the output as expected. I got it. I have > instead of -.
Thanks
Java translation
Good Kata! Loved it.
Haskell sample tests: wrong indentation level on line 10 onwards
fixed
In the description: "they returned array" should be "the returned array"
fixed
This comment has been hidden.
Please use appropriate markdown formatting when posting code. See https://docs.codewars.com/training/troubleshooting#post-discourse.
Your code does not meet the following requirement:
For example, for the input
"man i need a taxi up to ubud"
, your code incorrectly outputs{"a", "need", "ubud", "taxi", "i", "man", "to", "up"}
instead of{"a", "need", "ubud", "i", "taxi", "man", "to", "up"}
.This should not be in 7kyu, because for example with string "the time are", you have to compair h,m,r, also with longer example....
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/173.
Please join the discussion to help us identify duplicate kata and retire them.
This kata was decided to stay.
For JavaScript, on any online editor (jsfiddle or codepen...) it works but in codewars throw error? Not only this kata but also other katas have same problem, why?
Your comparison function is not correct.
The problem is, even if you fix it, tests will still fail but because of another bug. But still you need to fix your comarison function used by
sort
.I am going to re-raise this with more details on actual problem.
Seems to be already reported here: https://www.codewars.com/kata/57eba158e8ca2c8aba0002a0/discuss#629549bb2325a5003d1ae123
language PHP 7.0
expected and actual mixed up positions.
If two words have the same last letter, they returned array should show them in the order they appeared in the given string.
thats wrong to!
This task is too difficult for level 7
You complicated this a lot, you just need to use the sort method to achieve the result!
It's not as simple as that, is it??!?!
Update to Scala 3
Approved, thanks
D translation
Approved
Same code, works perfect on my visual studio. Here for some reason words change their position... Nvm, I had a small mistake in code. But it still worked on my machine not here.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
try yourself on javascript :|
Not a kata suggestion
test has " " which is not a word.
Rust translation.
Approved, thanks
This comment has been hidden.
For JS, there are random tests involving strings that only contain whitespace. The expected results for such cases are not defined in the Description so it seems these inputs are not valid.
Should be fixed in fork by @hobovsky
COBOL translation.
expected [ 'the', 'time', 'are', 'we', 'climbing', 'volcano', 'up', 'what' ] to deeply equal [ 'time', 'are', 'we', 'the', 'climbing', 'volcano', 'up', 'what' ]
But why???
reread the description
good kata
C# translation ready! Please review and approve.
Done, thanks
This comment has been hidden.
I bet you're not alone ^^
Oh wow. I didn't recall making this comment. I wrote this when I was around 7 Kyu. Looking back now, the kata actually wasn't that difficult at all.
Not all inputs are valid, some random tests do not contain words, only spaces with unexpected output (JS). Either remove those test cases, or fix expected outputs.
Forked python translation with new test framework used and 3.8 enabled ~~
This comment has been hidden.
expected: ["time","are","we","the","climbing","volcano","up","what"]
but got: ["the","time","are","we","climbing","volcano","up","what"]
LIKE WHAT???
The original string was:
'what time are we climbing up the volcano'
. You can see the expected is ok and the one you returned isn't. Also, it's been asked and answered before just a few posts below.Rlly? It was answered? I can't see it... Wut???
See plOnion's post below. Neither his post nor my answer is marked as spoiler so you should be able to see them.
ty :D lol
This comment has been hidden.
took me 4 hours...
i learnt how sort_by() function work
sort_by() function?
I keep getting this message: Cannot read property 'length' of null (javascript)
What do you expect to get for 'null' object?
Not quite sure what you are asking, but you can't call .length on a null. Issue in your code.
Python:
Description says array x, however the pre-supplied solution uses s.Should be fixed. Thanks
Tell my why is expected: '['time', 'are', 'we', 'the', 'climbing', 'volcano', 'up', 'what']', not '['the', 'time', 'are', 'we', 'climbing', 'volcano', 'up', 'what']' ?
The input is
"what time are we climbing up the volcano"
and because of this:I can't understand why, but my function works well and I obtain expected results using samples for testing locally rather than here. Could somebody please explain me why it happens?
Not without actually seeing your code, if you post it, remember to mark your post as having spoiler content. Normally that happens when you print the output instead of returning it, but that's just a guess.
This comment has been hidden.
You have a typo in your code, check it carefully.
Thanks much, I will do it
Scala translation available for review.
Approved
Haskell : https://www.codewars.com/kumite/5b7360da69826cc5a1000031?sel=5b7360da69826cc5a1000031
Approved
Sorry, this question is not related to this kata, but another one of similar type, never mind.
Hi, One of the test cases is failing, the result should have been empty list [], where as my result is coming a sorted list. Am I missing any instructions, If there is nothing to sort should that result []. I am sorting last characters 0to9,AtoZ,atoZ. Please suggest.
Python and Crystal translations submitted; if anyone approves them, then let me know and I might fix the wrong Ruby random tests :+1:
All done mate
Oh, how unexpected to hear from you directly!
Ruby tests fixed, plus we need to catch up a bit once you have some spare time for gitter ;)
Haha I like to make sure you're still Ok now and then...
Yeah sounds good, drop me a message
Approved this one, too.
good man, thanks
@petegarvin1: I just added the example test case in ruby you forgit to put this one. Hope this is ok for you.
All good, thanks