+ 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.
7 Respostas
+ 4
I don't know your algorithm but if you generate every permutation you will get a time out for long words.
+ 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.
+ 3
Have you taken care of that each version only exists once? Otherwise the rank will be off.
+ 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.
+ 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. 😉
+ 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.
+ 3
Thanks for your efforts.