6 kyu
Arrays of Lists of Sets
223 of 392KenKamau
Description:
In this Kata, you will be given a list of strings and your task will be to find the strings that have the same characters and return the sum of their positions as follows:
solve(["abc","abbc", "ab", "xyz", "xy", "zzyx"]) = [1,8]
-- we see that the elements at indices 0 and 1 have the same characters, as do those at indices 3 and 5.
-- we therefore return [1,8] because [0+1,3+5] = [1,8]. This result is sorted.
-- ignore those that don't have at least one matching partner, such as "ab" and "xy".
Another example...
solve(["wkskkkkkk","fokoo","wkskk","uizzzz","fokooff","wkskkkk","uizzzzzzz"]),[5,7,9]);
--The element at index 0 is similar to those at indices 2 and 5; so 0 + 2 + 5 = 7.
--The element at index 1 is similar to that at index 4; so 1 + 4 = 5.
--The element at index 3 is similar to that at index 6; so 3 + 6 = 9.
--The result must be sorted. We get [5,7,9].
More examples in the test cases.
Good luck!
Strings
Arrays
Algorithms
Similar Kata:
Stats:
Created | Dec 7, 2017 |
Published | Dec 7, 2017 |
Warriors Trained | 816 |
Total Skips | 8 |
Total Code Submissions | 1889 |
Total Times Completed | 392 |
Python Completions | 223 |
JavaScript Completions | 130 |
Ruby Completions | 42 |
Haskell Completions | 25 |
Total Stars | 21 |
% of votes with a positive feedback rating | 94% of 133 |
Total "Very Satisfied" Votes | 117 |
Total "Somewhat Satisfied" Votes | 15 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 6 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |