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.
No answer for 8 months: rejected.
Hi. It's a good idea. However you must add random tests. See: https://docs.codewars.com/authoring/translation
I really liked this exercise and wanted to translate it for Rust :).
Hi @kirbylife, thanks for the translation I just finished it.
I would like to notice that in the setup part of the translation, more precisely in function return value you forgot to add parentheses.
So there is a syntax error there.
I'm such an idiot =\ sorry and thank you. Don't know why I convinced myself that it should be sorted...
Hi, let's isolate the issue. The problem is not in your editor or CW, the
assert.deepEquals
method or the input length. Your code solves a different problem :)Look at the following case:
Hint: The description says: "return it as a list of tuples in order of appearance."
Regards,
suic
I'd be happy to attach a screenshot with the result. It doesn't but I can compare what it's expected with the output I receive in my editor - and they are the same.
All the directions I can get from test error messages show that the output is not sorted: all characters just follow the same sequence as they were in the input data. Which is strange, because I definitely return sorted one, and it is sorted testing in your own editor.
I know, it all seems too presumptuously for a 7 kyu memeber, but I'm just trying to find out what's wrong and I can't
How does your editor know the correct answer?
Yep, passing this input "1175192891585310852643994879501287928505966103527635411078058871457138431587047" for example. we expected [ [ '1', 12 ],
[ '5', 12 ], [ '8', 11 ],
[ '7', 9 ], [ '0', 7 ],
[ '9', 7 ], [ '3', 6 ],
[ '4', 6 ], [ '2', 5 ],
[ '6', 4 ] ] to deeply equal (and got this) [ [ '1', 12 ],
[ '7', 9 ], [ '5', 12 ],
[ '9', 7 ], [ '2', 5 ],
[ '8', 11 ], [ '3', 6 ],
[ '0', 7 ], [ '6', 4 ],
[ '4', 6 ] ]
But if I run the solution in my editor - I get the correct (sorted in descending order) output array. I ran out of ideas what could be wrong :(
if you carefully examine the random test error messages you can figure out how to correct your output based on the directions
Hello! I'm afraid I need help, but I don't want to refer to the solution. Could anyone please point what I'm doing wrong here:
const orderedCount = (text) => {
if (!text || text == '') {
return [];
}
let arr = text.split('');
let obj = {};
let resultArr = [];
for (let i = 0; i < arr.length; i++) {
let counter = 0;
arr.forEach(el => {
if (arr[i] == el) {
counter++;
}
});
obj[arr[i]] = counter;
}
for (p in obj) {
resultArr.push([p, obj[p]]);
}
resultArr = resultArr.sort((a,b)=>{return b[1]-a[1]});
return resultArr;
}
Sample tests were passed successfully, however I constantly receive the error 'to deeply equal' when it comes to long numbers passed as an argument - in such cases the output array isn't sorted for some reason. '212' test is ok. Ofc first I checked it myself with a number from a failed test - got the expected result. Thanks in advance, guys!
Approved.
Rust translation kumited.
Hi, I've approved it in the meantime. This type of comment normally goes to the kata discourse. Regards, suic
Rust translation kumited.
Loading more items...