+ 7

"Word Rank" and SOLOLEARN

Has anyone solved Code Coach's "Word Rank" and got it through the word SOLOLEARN? I'm pretty sure my solution should get the whole test. Unfortunately 3 tasks out of 6 are failed. Among other - what you can see - with the word SOLOLEARN which has a lot of permutations. Maybe somehow it could get on the tooth here.

4th Feb 2020, 6:39 PM
JaScript
JaScript - avatar
7 Réponses
+ 4
I don't know your algorithm but if you generate every permutation you will get a time out for long words.
4th Feb 2020, 7:34 PM
Denise Roßberg
Denise Roßberg - avatar
+ 4
I use Hashtable and List <string> (). The result of a permutation is compared with elements in hashtable. If it is not there, it will be written in the hashtable and in the list. After the process, the list will be sorted with Sort () and the result is delivered using IndexOf (). The hashtable is used because of the quick search. Each version exists only once. With another compiler the result of the task with the word SOLOLEARN is also the same as in Code Coach. But Code Coach shows no output (like time out) but before that is one and after that are two correct solutions. And everything takes in total a few seconds.
4th Feb 2020, 8:32 PM
JaScript
JaScript - avatar
+ 3
Have you taken care of that each version only exists once? Otherwise the rank will be off.
4th Feb 2020, 7:02 PM
HonFu
HonFu - avatar
+ 3
I recently finished it and I originally asked about it on here: https://www.sololearn.com/Discuss/2148558/?ref=app There are some good replies with a few methods of how to complete it.
4th Feb 2020, 7:31 PM
Pie
Pie - avatar
+ 3
Not in Python - there you can choose the lazy way and just sort a set of permutations. 😁 But better never use Python, it's just too slow. 😉
4th Feb 2020, 8:10 PM
HonFu
HonFu - avatar
+ 3
I had written a handmade permutation in C and wanted to extract the ranking from that, and it was also too slow, and I got no output. I tried another algo then which creates the permutations only once, and sorted, and that worked.
4th Feb 2020, 8:52 PM
HonFu
HonFu - avatar
+ 3
Thanks for your efforts.
4th Feb 2020, 10:04 PM
JaScript
JaScript - avatar