6 kyu

Prize Draw

242 of 7,119g964
Description
Loading description...
Fundamentals
Strings
Sorting
  • Please sign in or sign up to leave a comment.
  • Funki Avatar

    There seems to be a problem with the final tests in Rust (spelling?):

    basics_rank
    assertion failed: `(left == right)`
      left: `"William"`,
     right: `"Willaim"`
    
  • QrisiS Avatar

    This comment has been hidden.

  • Wed123 Avatar

    please explain the condition of the task If it is clear where the winning numbers come from, then why in the 2nd example, with n = 4, Paul won

  • ndegz Avatar

    Nice kata!

  • Milton1234 Avatar

    I think there is a problem with the button ATTEMPT for passing the complete set of 51 random tests. My code usually passes most of the random tests except 3 or 5 . Usually, the error displayed is “expected Elizabeth to equal Matthew.” On the other hand, when I manually compute the winning numbers from Elizabeth and Matthew, they are different. The same happens with the other errors. I suggest to review the random tests.

  • bash098 Avatar

    This comment has been hidden.

  • trashy_incel Avatar

    C fork

    • better assertion messages
    • it is explained what type of pointer to return
    • removing the reference solution from preloaded
  • sam1k1 Avatar

    In OCaml, we seems to have more elements than people. Which is not specified in the description and cause an error when doing we traversal to compute score.

  • ad-85 Avatar

    I think there's an issue with the final fixed tests for PowerShell. I'm not doing any manipulation on character order yet some have either the test case or the value passed in as $st that are misspelled.

    [2] Expected strings to be the same, but they were different.
    String lengths are both 7.
    Strings differ at index 4.
    Expected: 'Willaim'
    But was:  'William'
               ----^
    [3] Expected strings to be the same, but they were different.
    String lengths are both 6.
    Strings differ at index 4.
    Expected: 'Olivia'
    But was:  'Olivai'
               ----^
    
  • marodriguezs Avatar

    There is a problem with the tests. 4 in 104 fail and in all these cases it does not comply with the instruction: "When two people have the same winning number sort them alphabetically by their firstnames."

    The cases are:

    Log names: Elijah,Chloe,Elizabeth,Matthew,Natalie,Jayden weights: [1, 3, 5, 5, 3, 6] n:2 dat = Any["Matthew" "Elizabeth" "Jayden" "Natalie" "Chloe" "Elijah"; 485 485 390 207 144 51] winnums = Any[485, 485, 390, 207, 144, 51] key = 485 posall = [1, 2] outnames = SubString{String}["Matthew", "Elizabeth"] Actual Elizabeth Expect Matthew

    Log names: Lily,Lagon,Olivai,Emily,Madison,Olivia,Matthew,Noah weights: [6, 1, 2, 4, 1, 2, 3, 4] n:6 dat = Any["Lily" "Matthew" "Emily" "Noah" "Olivia" "Olivai" "Madison" "Lagon"; 372 291 276 168 148 148 82 54] winnums = Any[372, 291, 276, 168, 148, 148, 82, 54] key = 148 posall = [5, 6] outnames = SubString{String}["Olivia", "Olivai"] Actual Olivai Expect Olivia

    Log names: Alexander,Robert,Sophia,Michael,Lily,Samantha,Emily weights: [2, 1, 3, 3, 3, 4, 5] n:5 dat = Any["Emily" "Samantha" "Sophia" "Lily" "Alexander" "Michael" "Robert"; 345 340 222 186 186 174 84] winnums = Any[345, 340, 222, 186, 186, 174, 84] key = 186 posall = [4, 5] outnames = SubString{String}["Lily", "Alexander"] Actual Alexander Expect Lily

    Log names: Ella,Ella,Joshua,Samantha,Olivia,Madison,Sofia,Noah,Mason,Avery,David,Isabella,Olivai,Lily weights: [1, 4, 1, 5, 4, 3, 3, 5, 2, 3, 4, 5, 4, 5] n:5 dat = Any["Samantha" "Isabella" "Lily" "Olivai" "Olivia" "Madison" "Avery" "Noah" "David" "Sofia" "Ella" "Mason" "Joshua" "Ella"; 425 345 310 296 296 246 228 210 180 165 136 134 80 34] winnums = Any[425, 345, 310, 296, 296, 246, 228, 210, 180, 165, 136, 134, 80, 34] key = 296 posall = [4, 5] outnames = SubString{String}["Olivai", "Olivia"] Actual Olivai Expect Olivia

  • nestorliao Avatar

    nice kata, I love to gain pain which encourage me to solve harder problem and surpass myself. thank you, g964.

  • hexorhex Avatar

    This comment has been hidden.

  • letmecount Avatar

    Lovely kata, thank you g964 for great time

  • dmrkprnarf Avatar

    My solution is going through the testing phase. But I need to sort the names. For this kata, I need a codewars friend to get help from.

  • Dan_Ivy Avatar

    This comment has been hidden.

  • colinwilliams91 Avatar

    really unnecessarily convoluted.

  • Omux Avatar

    Good kata, problem description was clear but structured poorly. Read through it and look at the tests to help understanding, if you are having trouble be descriptive in your variable names.

  • AndyDaMandy Avatar

    This kata is purposefully tricky rather than poorly written. I recommend giving it another shot rather than dismissing it immediately.

  • coryshrmn Avatar

    Rust tests need to verify return type, otherwise my solution works (return Cheat type, which equals everything).

  • sztssp Avatar

    I read and read and reread the first few lines of instructions and then just gave up. Too bad it seems like a nice puzzle for sorting. It just promises to take too long to decipher a broken description

  • Larsa Avatar

    I quite enjoyed this kata. For me perhaps a little more difficult than most other 6kyu I have done. Pays to read the instructions carefully as I omitted to include the string length in my calcuations and sat looking and wondering why my solution was incorrect.

  • Quark Fox Avatar

    This comment has been hidden.

  • Lucarriza Avatar

    I think it should be a 5kyu level, pretty hard for a 6kyu ^^ but nice ;)

  • Logos24 Avatar

    The tests fail on Codewars:

    " Test Failed actual not equal to expected. 'current' is not a factor "

    When I use "testthat" and run the exact same code in Rstudio, it works fine.

  • TobiasR Avatar

    Uh, these special edge cases were killing it for me. Still thanks for the training!

  • MrAras7 Avatar

    The test cases are inconsistent.

    The first sample shows the first name which comes last is winner when there's tie in final points.

    NAMES :[Elijah, Chloe, Elizabeth, Matthew, Natalie, Jayden] WEIGHTS :[1, 3, 5, 5, 3, 6] THEIR SCORE :[51, 144, 485, 485, 207, 390] WINNER :2 FINAL CONTESTERS:[Elizabeth, Matthew] expected:<[Matthew]> but was:<[Elizabeth]>

    But the second is opposite of sample 1. NAMES :[Aubrey, Olivai, Abigail, Chloe, Andrew, Elizabeth] WEIGHTS :[3, 1, 4, 4, 3, 2] THEIR SCORE :[234, 74, 192, 192, 213, 194] WINNER :4 FINAL CONTESTERS:[Abigail, Chloe] expected:<[Abigail]> but was:<[Chloe]>

  • polterg3ist Avatar

    PYTHON

    Help me please! I don't understand what the problem is. On my computer, the same code with the same input data is executed without errors.

    Code:

    def rank(st, we, n):

    names = st.split(',')
    if not st: return "No participants"
    if n > len(names): return "Not enough participants"
    som_names = []
    alp_ranks = {chr(rank): rank - 96 for rank in range(97, 123)}
    
    for name in names:
        som = (sum([alp_ranks[letter.lower()] for letter in name]) + len(name)) * we.pop(0)
        som_names.append([som, name])
    
    som_names = sorted(som_names, key=lambda x: x[1], reverse=False)
    som_names = sorted(som_names, key=lambda x: x[0], reverse=True)
    
    return som_names[n-1][1]
    

    Error:

    Traceback (most recent call last): File "/workspace/default/.venv/lib/python3.10/site-packages/codewars_test/test_framework.py", line 112, in wrapper func() File "/workspace/default/tests.py", line 87, in randomTests test.assert_equals(rank(st, we, k), rankSol(st, we, k)) File "/workspace/default/tests.py", line 56, in rankSol res.append([f[i], we[i] * scoreSol(f[i])]) IndexError: list index out of range

  • marjan Avatar

    Quite complicated Kata. There you have to find out relation between unsorted and sorted array's indexes. Because you need it when you have to rearrange the string array.

  • bugdent Avatar

    The part people get confused at is picking the score at n, then picking the first name from a seperate sorted array of participants with that score. The name sorting is more like a tie breaker. For example if "a", "b", and "c" are tied for 3rd, b would be 4th. So if n is 4 you wouldn't be picking a, you would pick b.

  • KayleighWasTaken Avatar
  • 4500zenja1 Avatar

    Ruby translation for updating to 3.0 + resolving the issue

  • 4500zenja1 Avatar

    Powershell translation for updating to 7.2

  • user9990703 Avatar

    Thank you!! I learnt a lot about the sort function. Phew!

  • jdold07 Avatar

    That probably took me a little longer than it should have... but WOW!, it absolutely made me learn and understand exactly how to make sort() do what I want!

    EXCELLENT Kata ... how this only has 82% rating I just don't understand! I'd give it a VERY+ if I could!

  • laytone Avatar

    Hope this doesn't get marked as spoiler. If you're having issues dealing with ties, this is something i wish i had found out earlier.

    Dealing with ties by sorting in alphabetical order is mandatory it has to be done always.

    The problem is that the instructions read that IF there is a tie with the prize winner, this has to be solved by sorting in alphabetical order, but this has to be done regardless two people having the same winning number. Hope this helps

  • hedgehogV Avatar

    debugging this was a hell...

  • YuriiHryniv Avatar

    I enjoyed this kata.

  • R.Daneel.Olivaw Avatar

    Thanks to this kata, my sunday was bitter-sweet, but after a little nap, came back and solved it, the description could be a little bit misleading, but the learning was amazing!!! Thanks

  • Rse<3 Avatar

    In R it works fine. But Codewars sends me:

    Test Failed actual not equal to expected. 'current' is not a factor

    Why a factor? It has to be a character. as.factor not work...

  • Wheelwright Avatar

    Expected "William" to equal "Willaim"

  • dcordell Avatar

    Can anyone explain to me (Javascript) when I try to return a property on an object with index n-1, it returns undefined in codewars but works correctly in all browser consoles?

    See information below for context:

    n = 4

    0 { name: "Addison", winningNum: 292 } ​ 1 { name: "Michael", winningNum: 232 } ​ 2 { name: "Andrew", winningNum: 213 } ​ 3 { name: "Benjamin", winningNum: 152 } ​ 4 { name: "Jayden", winningNum: 130 } ​ 5 { name: "Lily", winningNum: 62 } ​ 6 { name: "Sofia", winningNum: 55 }

    returning the object.name property with the the index [n] works... [n -1], however, (Since rank starts at 1) returns undefined. Perhaps not the best way to solve the problem, but I'm a bit perplexed why this is happening...

    Any insight? Thanks :)

  • rickansen Avatar

    so close, i cant sort the test where all of the elements have a pair of the same winning numbers.

  • Blind4Basics Avatar

    Ruby 3.0 should be enabled (Refer this & this for more detail)

  • laurelis24 Avatar

    I honestly spent so much time on this one. Felt hard, but somehow managed to solve it. Now I feel like a wizard. xD Nice kata...

  • Dash Zardykhan Avatar

    This is lvl 5 defo.

  • Aleksandr Semenikhin Avatar

    OK, one more kata and I go to sleep


    not going to sleep for three hours

  • mastodonte Avatar

    Hello, I don't understand why my code passes the test, but when I attemp to commit my solution one test fails: Fixed Tests expected:<Will[ai]m> but was:<Will[ia]m>

    Could you send me the test that runs when "attemp" is clicked please?

  • MacirBrustolin Avatar

    Way harder to understand than should be

  • celiackelly Avatar

    I created a 2D array with the names of the participants and their winning numbers in descending order.

    let sorted = [ [ 'Addison', 348 ], [ 'Michael', 288 ], [ 'Andrew', 249 ], [ 'Benjamin', 184 ], [ 'Jayden', 154 ], [ 'Lily', 70 ], [ 'Sofia', 65 ] ]

    For the first test case where n=4 and the winner is Benjamin, I am trying to return sorted[n - 1][0], I get the error that it can't access the property [0] of undefined. However, when I console log this expression, it works just fine and prints 'Benjamin.' Also, the return statement works just fine in VSCode.

    I haven't dealt with the instances where the string is empty or n is greater than the number of participants yet.

    function rank(names, weights, n) { const calcSom = (name) => name.toLowerCase() .split('') .reduce((sum, ch) => sum + (ch.charCodeAt(0) - 94), 0) + name.length

    const winningNums = names.split(',')
                           .map((name, i) => calcSom(name) * weights[i])
    
    let namesAndNums = names.split(',')
                            .reduce((arr, name, i) => {
                               arr[i] = [name, winningNums[i]]
                               return arr
                              }, [])
    
    let sorted = namesAndNums.sort((a, b) => b[1] - a[1] || b[0] - a[0])
    
    console.log(sorted)
    
    //The winner is at index n-1, because the position n is not zero-indexed. This console.log() statement works fine and gives the correct winner, 'Benjamin'
    console.log(sorted[n - 1][0])
    
    //BUT the return statement yields undefined on CodeWars. But it works fine in VSCode!
    return sorted[n - 1][0]
    

    }

  • ejini战神 Avatar

    Great kata, my 5.1Kth one as well ^O^

  • ejini战神 Avatar
    • Node 14 should be enabled (Refer this and this for more info)

    • Python new test framework should be used (Refer this & this for more detail)

    • Ruby 3.0 should be enabled (Refer this & this for more detail)

  • ejini战神 Avatar
    • Typescript 3.3 or above should be enabled, refer this for more info

    • Missing return type in initial solution of TS

  • mlordmailbox@gmail.com Avatar

    Badly worded and confusing. Coding is hard enough without trying to translate a badly worded problem. I'm skipping this.

  • Unusual_Frog Avatar

    needs a rewrite on description, I understand what its asking for after 30 mins of interperting but you really just need to explain the specific input and out put and thats all, this kind of challenge dosent need narative fluff

  • rsdah13 Avatar

    The directions are a bit sparse. I think using the word "rank" to signify both the letter_value and the position in sorted winning_numbers could be confusing.

  • Prathamesh_123 Avatar

    st = "Elijah,Chloe,Elizabeth,Matthew,Natalie,Jayden"; we = new Integer[] {1, 3, 5, 5, 3, 6}; assertEquals("Matthew", Rank.nthRank(st, we, 2)); why matthew insted of elizabeth if we arrange alphabetically elizabeth comes first

  • mTheDestroyer Avatar

    Tried it in C++: I have problem bei dude called Willaim and William...

    The Kata description says "Sort them Aphabetically": in my opinion William is higher (in decreased) order than Willaim, because they differ in 5th Letter and i is more than a... or?

  • lmk2014 Avatar

    Log {'Elijah': 51, 'Chloe': 144, 'Elizabeth': 485, 'Matthew': 485, 'Natalie': 207, 'Jayden': 390} 'Elizabeth' should equal 'Matthew'

  • ericfariaz Avatar

    Poorly written instructions, I'd skip this one.

  • SiamRahman29 Avatar

    I'm doing this in Python 3.8 and I need to use the string module. I imported it on my computer and the solution works offline but it's not working on the site. Can we not import modules on Codewars?

  • nanda@ng Avatar

    What should I return? I can't understand clearly this Kata, but it seems easy. Can anyone help?

  • PythonEnjoyer Avatar

    I took a look at the description and I immedietly skipped it

  • Bean42 Avatar

    I am writing this to share my frustration.

    That kata itself is not difficult.

    The description made it not clear what is being asked.

    why is Paul selected amoung list of names as an example?

    He isn't the winner. I thought he was. I was mislead and wasted time trying to understand why paul was selected.

  • shash28 Avatar

    It's giving me an error in codewar platform that obje.flat() is not a method is it not supported here? because it's working fine in console

    function getRank(str,weights,rank){ if(str=="") return "No participants" if(str.split(',').length<rank) return "Not enough participants" else { const splitArr=str.split(',') let arr={} for(let i=0;i<splitArr.length;i++){ arr[splitArr[i]]=Som(splitArr[i])*weights[i] } return getValue(arr,splitArr,rank) } }

    function getValue(arr,splitArr,rank){ const obje=Object.entries(arr) const flatArr=obje.flat().filter(item=>typeof(item)=='number') const bool=flatArr.map((item,i)=>flatArr.indexOf(item)==i).includes(false) let res; if(bool){ res=obje.sort() return res[rank-1].slice(0,1).toString() } else{
    res=obje.sort((a,b)=>b[1]-a[1])

    return res[rank-1].slice(0,1).toString()
    
       }
    

    }

    function Som(str){ const newStr=str.toLowerCase().split('') const alphabets="abcdefghijklmnopqrstuvwxyz" let sum=0; for(let i=0;i<newStr.length;i++){ sum+=alphabets.indexOf(newStr[i])+1 } return sum

    }

    getRank("Addison,Jayden,Sofia,Michael,Andrew,Lily,Benjamin", [4, 2, 1, 4, 3, 1, 2], 8)

  • Opabinia Avatar

    Solved this one in ReasonML — thanks again for another kata that... was much more of a faff to complete than it had any right to be 😆! Still, at least I'm getting better at Reason / OCaml, which I seem to be finding hard mostly because of the inflexibility of the types in the standard library (I'd just like to use one map for everything, dammit!)

    I really appreciate, g964, that you have translated this kata to Reason, as you're seemingly the only author to have uploaded any Reason-language kata at all. Thanks!

  • kbanach Avatar

    The description of this kata is a terrible mess... Please rewrite it in actual English without the story. Just keep it simple: what is the input, what is the output and why. Currently there is "PauL" used as an example, which causes more questions than given answers. Subjectively that's the most unclear kata that I did since now.

  • julianchso Avatar

    Can someone help me? I'm doing it in javascript. This is the test I'm failing, which I'm assuming is due to sorting alphabetically.

    expected 'Elizabeth' to equal 'Matthew'

    What data structure should I use?

    My pseudocode: I store everything in an object where key is the name, value is the score. I also store the score in an array since object is unordered. I then sort the array, which I use the value (score) to find the key in the object.

    Doesn't really work when the score is the same.

    I really enjoyed this kata though. For a beginner like me, it's challenging enough and not so easy where I can solve with 2 loops but still think it's doable.

  • valnikolov Avatar

    This comment has been hidden.

  • webdev3 Avatar

    I really wish more time was taken to write proper expectations around the result. I think more time is spent trying to understand the verboseness of the task.

  • achambily Avatar

    Nice kata, very brain shaking !

  • RonsterJ Avatar

    Hitting attempt without any changes over and over and getting anywhere between 1 and 4 failed tests makes me think the tests are broken...

  • Sr-3pp Avatar

    Nice Kata for learning C.

    Difficult but tasty.

  • Tahera1980 Avatar

    My code passes the sample tests but not all the random tests. Can anybody tell me where is the problem. Thanx.

  • stanislavrepin Avatar

    "Ethan,Sophia,Elijah,Addison,Alexander,Matthew,Abigail,Logan,Mason,Isabella,Chloe,Jacob,William,Grace,Benjamin,Michael,Lily,Aiden,Avery,James,Mia,Noah,Ava", [ 3, 4, 4, 4, 4, 1, 4, 1, 6, 3, 5, 3, 3, 5, 1, 3, 1, 2, 4, 4, 1, 3, 5 ], 2), "Alexander") case gives mecorrect result in ide and gives error it test.. JS

    function rank(st, we, n) {
    if (st.length === 0) return "No participants";
    else if (n > st.split(',').length) return "Not enough participants";
    

    let albt = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] let vinNum = st.toLowerCase().split(',').map( (el,i) => (el.split(''). reduce( (acc,cur) => acc + +albt.indexOf(cur) + 1,0) + el.length) * we[i]); let lst = st.split(',').reduce( (acc,cur,i) => { return acc.push([cur,vinNum[i]]),acc; },[]).sort(([a,b],[c,d] ) => d - b ).sort(([a,b], [c,d]) => { return b === d && a.length === c.length ? -1 : 0; }); return lst[n-1][0]; }

    console.log(rank("COLIN,AMANDBA,AMANDAB,CAROL,PauL,JOSEPH", [1, 4, 4, 5, 2, 1], 4), "PauL"); console.log(rank("William,Willaim,Olivia,Olivai,Lily,Lyli", [ 1, 1, 1, 1, 1, 1 ], 1), "Willaim"); console.log(rank("Elijah,Chloe,Elizabeth,Matthew,Natalie,Jayden", [ 1, 3, 5, 5, 3, 6 ], 2), "Matthew"); console.log(rank("Ethan,Sophia,Elijah,Addison,Alexander,Matthew,Abigail,Logan,Mason,Isabella,Chloe,Jacob,William,Grace,Benjamin,Michael,Lily,Aiden,Avery,James,Mia,Noah,Ava", [ 3, 4, 4, 4, 4, 1, 4, 1, 6, 3, 5, 3, 3, 5, 1, 3, 1, 2, 4, 4, 1, 3, 5 ], 2), "Alexander");

  • Tahera1980 Avatar

    How to see the test inputs. Can any let me know as soon as possible.

  • Bokkii Avatar

    This comment has been hidden.

  • EpikError Avatar

    What don't I understand on the example test rank("Lagon,Lily", [1, 5], 2) == "Lagon")

    ranks = [(54, 'Lagon'), (310, 'Lily')] 'Lily' is the second ranked name, why is 'Lagon' the desired name? No one else seems to have this problem. Any clues appreciated.

  • MoAz101 Avatar

    the problem with these questions is not that they're hard its that i legit spend decades trying to understand the questions...i dont get an answer at the end

  • Shakhzod_K Avatar

    I have a question about last step, it says that if there is two names with same score, we should sort it by there first name, in case Matthew and Elizabeth, test case says that Matthew is the output, but why? E is coming first not M, and output should be Elizabeth, who can explain it?

  • wisniaboss2 Avatar

    Aiden,Logan,Aubrey,Michael,Lily,James,Abigail,Lagon,Mason,Willaim,Ethan,Emily,Robert,Jayden,Benjamin,Andrew,Isabella, [5,3,2,6,5,3,3,2,2,1,6,3,4,1,4,1,3], 7 Log [ 190, 162, 156, 348, 310, 159, 144, 108, 134, 86, 318, 207, 336, 65, 304, 71, 207 ] It should work for random tests too - Expected: 'Isabella', instead got: 'Emily'

    Hmm I thought that E is before I

  • kaledoux Avatar

    I can't seem to pass the test case where Matthew and Elizabeth are supposed to evaluate to the same total value, and thus be sorted alphabetically. My issue here is that those two names don't amount to the same total value. I tore my logic apart and went through the hard way, matching chars up by their place value; I can't find a way where the two names would ever have the same value... I am operating under the assumption that both lowercase and uppercase letters are treated identically concerning value, as this appears to be made implicit through the examples given. (so "A" == 1 and "a" == 1, meaning that a downcased name is equivalent to the mixed case, or uppercase equivalent; so "Elizabeth" == "ELIZABETH" == "EliZabETh" etc etc)

    First, the letters and their associated values: alpha_value = { "a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5, "f"=>6, "g"=>7, "h"=>8, "i"=>9, "j"=>10, "k"=>11, "l"=>12, "m"=>13, "n"=>14, "o"=>15, "p"=>16, "q"=>17, "r"=>18, "s"=>19, "t"=>20, "u"=>21, "v"=>22, "w"=>23, "x"=>24, "y"=>25, "z"=>26}

    Elizabeth split into chars (downcased for ease) and valued out by char

    [["e", 5], ["l", 12], ["i", 9], ["z", 26], ["a", 1], ["b", 2], ["e", 5], ["t", 20], ["h", 8]]

    sum of letters:

    5 + 12 + 9 + 26 + 1 + 2 + 5 + 20 + 8 == 88 # true

    Matthew split into chars (downcased for ease) and valued out by char

    [["m", 13], ["a", 1], ["t", 20], ["t", 20], ["h", 8], ["e", 5], ["w", 23]]

    sum of letters:

    13 + 1 + 20 + 20 + 8 + 5 + 23 == 90 #true

    Given the names and weights for the test case

    "Elijah,Chloe,Elizabeth,Matthew,Natalie,Jayden" [1, 3, 5, 5, 3, 6]

    I would reason this out to be:

    names_array = ["Elijah", "Chloe", "Elizabeth", "Matthew", "Natalie", "Jayden"] weights = [1, 3, 5, 5, 3, 6]

    Which would mean that the respective "weights" of each name in question is 5

    So based on the weights, and the totals of the characters, they come out to

    different values...

    elizabeth = 88 * 5 ==> 440

    matthew = 90 * 5 ==> 450

    Based on this step by step, I can't see where I might be going wrong with the calculation. They have different total values based on the characters in the names and the assigned weights. Why would "Elizabeth" not be ordered after "Matthew" in this context?

  • Blackkk68 Avatar

    JavaScript

    Could anybody help me, please?

    My code works correctly with all basic tests except two: ("Aubrey,Olivai,Abigail,Chloe,Andrew,Elizabeth", [3, 1, 4, 4, 3, 2], 4) Expected: 'Abigail', instead got: 'Chloe' and ("Elijah,Chloe,Elizabeth,Matthew,Natalie,Jayden", [1, 3, 5, 5, 3, 6], 2) Expected: 'Matthew', instead got: 'Elizabeth'.

    Both of them I counted manually and got the same result as my code. What is wrong?

  • Ivan_Danyliuk Avatar

    It's definately hardest kata of 6kyu I've completed ever. Maybe it should be defined as 5kyu?

  • jeffmbellucci Avatar

    This is by far the hardest 6kyu I've completed. Most 5's and even some 4's that I've solved are easier. Is there any consideration for regrading this Kata?

  • AdvancedKoala Avatar

    Gave up trying to fix my code to deal with ties - this is way too hard for 6kyu

  • Ze-Marcos Avatar

    This comment has been hidden.

  • klaufir Avatar

    The Nim version can not be completed due to getting warnings from the test suite & receiving Exit Code: 1, despite all of the test cases passing.

    /workspace/solution_tests.nim(84, 12) template/generic instantiation of `shuffle` from here
    /workspace/solution_tests.nim(78, 13) Warning: Deprecated since v0.18.0; use 'rand' instead; random is deprecated [Deprecated]
    /workspace/solution_tests.nim(92, 19) Warning: Deprecated since v0.18.0; use 'rand' instead; random is deprecated [Deprecated]
    /workspace/solution_tests.nim(121, 7) template/generic instantiation of `suite` from here
    /workspace/solution_tests.nim(123, 18) Warning: Deprecated since v0.18.0; use 'rand' instead; random is deprecated [Deprecated]
    /workspace/solution_tests.nim(121, 7) template/generic instantiation of `suite` from here
    /workspace/solution_tests.nim(126, 17) Warning: Deprecated since v0.18.0; use 'rand' instead; random is deprecated [Deprecated]
    Error: execution of an external program failed: '/workspace/tests '
    
  • nomennescio Avatar

    The C test code does not adhere to the description in case of no participants. The description requires "Not enough participants", whereas the test code checks for "No participants"

  • ghostrider77 Avatar

    This comment has been hidden.

  • Pavelick Avatar

    This comment has been hidden.

  • NekomataD Avatar

    Im hardstuck with the " When two people have the same winning number sort them alphabetically by their firstnames." , someone managed to solve this with a HashMap / Treemap ?

  • wiz0rd Avatar

    Still stuck, here is what I have so far. I tried putting the entire code into a Try Except - but it still didn't show me the test case that was failing. Passing all the basic tested up to #18

    def rank(st=9999, we=9999, n=9999): try: print(st,we,n) st = st.split(',')

        alpha_score = {
            'a':1,
            'b':2,
            'c':3,
            'd':4,
            'e':5,
            'f':6,
            'g':7,
            'h':8,
            'i':9,
            'j':10,
            'k':11,
            'l':12,
            'm':13,
            'n':14,
            'o':15,
            'p':16,
            'q':17,
            'r':18,
            's':19,
            't':20,
            'u':21,
            'v':22,
            'w':23,
            'x':24,
            'y':25,
            'z':26,
        }
    
        if st == 9999:
            return 'No participants'
    
        elif st[0].isalpha():
        
        #try:
            if n > len(st):
                return 'Not enough participants'
        
        
            else:
                n = n - 1
                score_list = []
                name_list = []
                sorted_name_list = []
                sorted_score_list = []
                score_name = {}
    
                for name in st:
    
                    som = 0
                    som += len(name)
                    for letter in name.lower():
                        som += alpha_score[letter]
                    som = som * we.pop(0)
                    if som in score_list:
                        name_confirm = []
                        name_confirm.append(score_name[som])
                        name_confirm.append(name)
                        name_confirm.sort()
                        if name_confirm[0] == name:
                            som += .01
                            score_list.append(som)
                            score_name[som] = name
                        else:
                            som -= .01
                            score_list.append(som)
                            score_name[som] = name
                        
                    else:
                        score_list.append(som)
                        score_name[som] = name
                
                for k,v in sorted(score_name.items(), reverse=True):
                    sorted_score_list.append(k)
                    sorted_name_list.append(v)
    
            return sorted_name_list[n]
    #except:
            print(st, we, k)
        
        else:
            return 'No participants'
    except IndexError:
        print(st, we, k)
    
  • bdcovington Avatar

    Ok, I can't understand this. My code (python) works in every single instance except for where the code is telling me it's supposed to be returning Matthew instead of Elizabeth. The system isn't reporting the test parameters to me, so my only assumption is that both numbers have the same weight, otherwise this wouldn't be an issue.

    Elizabeth has a total value of 97, Matthew has a total value of 97, if they're the top contenders and they're tied then Elizabeth needs to be returned, but the test keeps saying Matthew is the correct answer, and that's can't be right. This is the only test that's failing, can someone please help me understand what I'm missing here without referring me to the comments below? I've read them all, the solution isn't there.

  • wiz0rd Avatar

    I'm trying to solve this with python and I am getting the following: STDERR Traceback (most recent call last): File "main.py", line 85, in randomTests() File "main.py", line 83, in randomTests Test.assert_equals(rank(st, we, k), rankSol(st, we, k)) File "main.py", line 52, in rankSol res.append([f[i], we[i] * scoreSol(f[i])]) IndexError: list index out of range

    I know list index out of range is usually from calling an out of range index value on a list, like lista = [0, 1, 2] and then I try and run lista[3] but I am not really sure where this could be happening in my code. Any thoughts are appreciated!

    Thanks!

  • GabrielSaul Avatar

    This comment has been hidden.

  • Bunny97 Avatar

    Hey i got a error saying

            ./src/main/java/Rank.java:21: error: cannot find symbol
                          ArrayList savname = new ArrayList();
                          ^
              symbol:   class ArrayList
              location: class Rank
            ./src/main/java/Rank.java:21: error: cannot find symbol
                          ArrayList savname = new ArrayList();
                                                  ^
              symbol:   class ArrayList
              location: class Rank
            ./src/main/java/Rank.java:65: error: cannot find symbol
                          Arrays.sort(sum2);
                          ^
              symbol:   variable Arrays
              location: class Rank
            ./src/main/java/Rank.java:94: error: cannot find symbol
                           Collections.sort(savname);
                           ^
              symbol:   variable Collections
              location: class Rank
            4 errors
            
    

    I imported java.util.*; but it's still showing me same error what should i do?

  • _funemy Avatar

    Hey I got the following compilation error when I try to solve this kata in ocaml

    The error message doesn't really make sense to me, and I cannot reproduce it on my local machine (I passed the test and the code can be compiled locally)

    Wonder if I can get any help here, thanks

    + ocamlfind ocamlc -c -thread -package oUnit -package batteries -package core -o fixture.cmo fixture.ml
    File "fixture.ml", line 56, characters 32-48:
    Warning 3: deprecated: Stdlib.String.uppercase
    Use String.uppercase_ascii instead.
    File "fixture.ml", line 76, characters 27-28:
    Error: This expression has type (int * string) array
           but an expression was expected of type (int * Char.t) array
           Type string is not compatible with type Char.t = char 
    Command exited with code 2.
    
  • wpok13 Avatar

    I think this kata is for 5th kyu, not 6th. A lot of work.

  • The_Boss_007 Avatar

    Is there a way to flag a Kata? Because during the attempt phase the input is not shown. Therefore, it is extremely difficoult to find where the code goes wrong.

  • The_Boss_007 Avatar

    It is unfortunate, that the test results do not show the input. Therefore, it is very difficult to figure out where the code goes wrong.

  • MarkyMark1000 Avatar

    From the question:

    1. "An array of random weights is linked to the firstnames and each som is multiplied by its corresponding weight to get what they call a winning number."

    2. The Example: PauL -> som = length of firstname + 16 + 1 + 21 + 12 = 4 + 50 -> 54 The weight associated with PauL is 2 so PauL's winning number is 54

    Given that part 1 states that "each som is multiplied by its corresponding weight", this doesn't make sense. Surely PauL's winning number should be 108, not 54.

  • BatonSzachista Avatar

    My code in C keeps passing most of the tests but fails one, returning "Test Crashed, Signal Code:11". I know it stands for segmentaion fault but this doesn't really seem right. Is there anyway I could see what the test exactly was, since there is nothing concerning this particular test in output log?

  • TixorCoder Avatar

    This comment has been hidden.

  • TixorCoder Avatar

    Any clues why my code returns the correct result when checking it on the local console and the wrong one when trying to pass the test on CodeWars? It happens in the Basic test (the first one) and in several of the random ones.

  • Lefthander Avatar

    I think description should mention that there are possible situations where number of weights can be more than number of participants.

  • thanasisSot Avatar

    Test Case Number 2: WHY ==> 'Elizabeth' should equal 'Matthew' i am calculating their values to be both 485, so alphabetically is Elizabeth 1st. i am getting 66 Passed Tests and 2 Failed, both same case as this.

  • Chrono79 Avatar

    Rename the partial value of the instructions to something else, n is already used as a function's argument and that's a little confusing.

    The length of the firstname is added to the sum of these ranks hence a number m. An array of random weights is linked to the firstnames and each m is multiplied by its corresponding weight to get what they call a winning number.

    Something like that or whatever name not used in another part you want would be fine.

  • johnnybar Avatar

    Hi, I'm definitely missing something, so could someone please clarify? - If n is calculated by the first name length + rank of each letter in the name, why is n provided as an argument in the function? I would think we would get the string argument, weights argument and then calculate n ourselves, using it to calculate the 'winning number'... Thanks for your help

  • Constructer Avatar

    Why I'm see different result of sorting array in Chrome and site (Codewars) on some random tests? Visual Studio Code give result like codewars and I'm not understand it. Code in clear Chrome work perfect.

  • Sepero Avatar

    It's a good challenge, but the obscurity in the description takes away from it's value. The description on this kata could make a few things a little more explicit:

    1. Parameter n starts from 1 (not 0).
    2. The higher rank = lower n (the largest number rank will be n=1).
    3. Case does Not matter when calcutaing ranks, so you should probably convert names to all lower or upper case before calculating ranks.
    4. You will need to be able to fully sort the names alphabetically, ex. Brain comes before Brian.

    . The best kata's are the one's which present clear rules for answering the challenge, and the challenge is implementing those rules into code.

  • macnick Avatar

    I like problems with multiple element sorting. Thanks!

  • Tigerhub779 Avatar

    My program can't find the another name of a duplicate score HUHUHUHUHUHUHUHU

  • Hanx10 Avatar

    This comment has been hidden.

  • Tigerhub779 Avatar

    This kata hates me!!! expected:<N[ao]h> but was:<N[oa]h>

  • neroClaud Avatar

    nice kata,cheers !

  • MrCoetzee Avatar

    Some assistance please,

    For the F# test case with the following inputs: st = "Addison,Jayden,Sofia,Michael,Andrew,Lily,Benjamin", we = [|4; 2; 1; 4; 3; 1; 2|], n = 8

    n = 8, but there are only 7 names?

    Is this correct?

  • RShtiltskin Avatar

    Hi. Can someone help me with the problem? When I run my code of this task in another place (www.codepen), I receive a correct results of incorrect tests.

  • vish4luffy Avatar

    Hey g964,

    I'm a fan of your katas. Is there any way to get in touch with you on a 1-on-1 basis please?

    regards, vish

  • OpenByte Avatar

    Are the random tests for javascript wrong? My solution passed all the fixed tests, but fails on the random ones. I tried submitting my solution on TypeScript and it passed.

  • quadmaddoc Avatar

    This comment has been hidden.

  • Chocoblol Avatar

    JavaScript, all tests passed, except one, where: Expected: 'Willaim', instead got: 'William'

  • wylaris Avatar

    I don't think the tests in Rust are accurate. I'm fairly certain I have a working solution but I am still failing the tests and the asserts are not making sense.

  • accord75 Avatar

    Clojure kata fails on this testcase: n = 3 | we = [5 5 3 2 1 3 6] | st = "Avery,Olivai,Sophia,Michael,Elizabeth,Willaim,Liam,AsToR"

    st contains 8 names, but we is of length 7. Please look into this.

  • della-90 Avatar

    Kotlin translation submitted here

  • novarose Avatar

    I can't help but wonder whether or not this is really a 6 kyu(I think it is harder than the 6 kyus i've completed), but my main criticism is that the sample tests aren't verbose enough to catch issues that would arise from not handling parsing lowercase / uppercase properly.

  • Yacoub Salah Avatar

    This comment has been hidden.

  • tzdybal Avatar

    Hi! I created Go translation of this kata. Please take a look: https://www.codewars.com/kumite/5bef24a4aef7123f4700023c?sel=5bef24a4aef7123f4700023c

  • yerlanyr Avatar

    There is an issue when N == Size test it expecting for "Not enough participants" result, though there are enough participants. So i tweaked my solution N - 1 like that it worked, but i think the test might be wrong.

  • benner64 Avatar

    so just like what seems to be everyone else I cant really get it to work when I attempt. It works really well for the most part but with the “William” I get an error, which leads to mistakes in the random part. Now I would like to the the parameters the attempt run on so I can fix this.

    Thanks for any help!

  • mmacak28 Avatar

    I am passing all of tests cases except of one with "Elijah,Chloe,Elizabeth,Matthew,Natalie,Jayden" I get Matthew and Elizabeth with n = 485 and I dont understand why Matthew should be returned and not Elizabeth. I would be grateful for any hint

  • CodingWarrior Avatar

    I'm not clear on the instructions and the purpose of calculating the winning number for each person, do we have to sort each winning number-person pair, and then return the name whose index= n? If someone can paraphrase the whole instruction more clearly, I'd really appreciate it

  • jsdevtom Avatar

    Thank you for this. I recommend naming the variables explicitly next time. For example naming n what ever that was (index_of_winner?) and we (weights?). Such short names are advised against in books such as clean code because it unnecessarily obfuscates the codes meaning

  • sazzadshopno Avatar

    Thanks, that was fun

  • pierovera Avatar

    Upon returning to this kata, I've found out why it acts strangely in C. Sometimes, during random testing, there will be a comma at the end of the list of participants, which, if you're counting participants using the delimiting character, will make the program crash. I think it is pretty ridiculous to have to account for this, when the kata does not specify anything regarding empty elements in the list. Additionally, since the sample tests do not have any cases like this one, it makes it kind of cryptic to decipher the issue. It would be nice if this could be revised. Thanks.

  • kristofvdj88 Avatar

    This comment has been hidden.

  • dominguez-p Avatar

    Help please!

    Hi, first of all, congrats for the kata, it's nice!. I've written my code and it passes most of the test (but not all). Focus on basic test, my code passes 16 of 18 tests. I've been reviewing my code for long time but I don't find the error, I need help. I write in console lots of logs in order to help me, and this is the result:

    Data entry: st = Elijah,Chloe,Elizabeth,Matthew,Natalie,Jayden we = 1,3,5,5,3,6 n (position searched) = 2 letter E weigths 5 letter L weigths 12 letter I weigths 9 letter J weigths 10 letter A weigths 1 letter H weigths 8 length of Elijah = 45 weigth of Elijah = 1 winning number of Elijah = 45 letter C weigths 3 letter H weigths 8 letter L weigths 12 letter O weigths 15 letter E weigths 5 length of Chloe = 43 weigth of Chloe = 3 winning number of Chloe = 129 letter E weigths 5 letter L weigths 12 letter I weigths 9 letter Z weigths 26 letter A weigths 1 letter B weigths 2 letter E weigths 5 letter T weigths 20 letter H weigths 8 length of Elizabeth = 88 weigth of Elizabeth = 5 winning number of Elizabeth = 440 letter M weigths 13 letter A weigths 1 letter T weigths 20 letter T weigths 20 letter H weigths 8 letter E weigths 5 letter W weigths 23 length of Matthew = 90 weigth of Matthew = 5 winning number of Matthew = 450 letter N weigths 14 letter A weigths 1 letter T weigths 20 letter A weigths 1 letter L weigths 12 letter I weigths 9 letter E weigths 5 length of Natalie = 62 weigth of Natalie = 3 winning number of Natalie = 186 letter J weigths 10 letter A weigths 1 letter Y weigths 25 letter D weigths 4 letter E weigths 5 letter N weigths 14 length of Jayden = 59 weigth of Jayden = 6 winning number of Jayden = 354 [ { name: 'Matthew', weigh: 450 }, { name: 'Elizabeth', weigh: 440 }, { name: 'Jayden', weigh: 354 }, { name: 'Natalie', weigh: 186 }, { name: 'Chloe', weigh: 129 }, { name: 'Elijah', weigh: 45 } ] Expected: 'Matthew', instead got: 'Elizabeth'

    ================================================================ I hope someone can help me because I follow the figures until the last array (sorted) and I don't understand why "Matthew" is expected in position 2 in this test. I assume the kata is correct and I'm wrong, so I'll be grateful if someone can help me. Thanks in advance.

  • ProstoNekitos Avatar

    Good day

    Input: Addison,Jayden,Sofia,Michael,Andrew,Lily,Benjamin 4, 2, 1, 4, 3, 1, 2 n=4

    Output:

    1. Addison - 292
    2. Michael - 232
    3. Andrew - 213
    4. Jayden - 130 <- I think it's the answer
    5. Benjamin - 76 <- It is the "correct" answer
    6. Lily - 62
    7. Sofia - 55

    This is incorrect test? Or maybe i've got logical mistake somewhere?

  • rohmadraharjo Avatar

    For those who think your solution is correct make sure reorder your rank by name if two or more people have same score. Stuck on there for a while

  • martline1 Avatar

    Hey, I have a problem, I run my code on local and it works perfectly for all cases, but when I tried to run it in this page it doesn't work, any idea why?

  • pierovera Avatar

    I am unable to complete this kata in C. My program runs all the sample tests, as well as any tests I run myself outside of this. However, during random testing, it gets through (on average) 30 tests before one just segfaults the program and fails. It gives me absolutely no way to fix the issue, as I cannot reproduce it locally and it doesn't tell me what input it tried using that crashed the program. It doesn't seem to follow any pattern, it just will sometimes get tripped up and crash. I cannot complete the kata.

  • SeeFoEv Avatar

    There seems to be a problem with the test for the alphabetical order of the winners... "Matthew" does not come before "Elizabeth" in case both have the same points.

  • ayubov Avatar

    Nice kata. Thank you.

  • Xymis Avatar

    Hi. May you can help me with test module? My code has passed all basic test, but when I want a atempt code I saw:

    STDERR: ValueError: ....

    That not possible in my solution. What to do, that pass the problem?

    P.S. I'm sorry, if you can't understand me. My english skill is low, but I will fix it. I'm promise

  • loothood Avatar

    Hi! Can you help me please? I don't understand an example. "#Example: names: COLIN,AMANDBA,AMANDAB,CAROL,PauL,JOSEPH weights: [1, 4, 4, 5, 2, 1] n: 4 The function should return: PauL" But: C O L I N (3+15+12+9+14 + 5) * 1 = 58 A M A N D B A (1+13+1+14+4+2+1 + 7) * 4 = 172 A M A N D A B (1+13+1+14+4+1+2 + 7) * 4 = 172 C A R O L (3+1+18+15+12 + 5) * 5 = 270 P A U L (16+1+21+12 + 4) * 2 = 108 J O S E P H (10+15+19+5+16+8 + 6) * 1 = 79

    So, sorted names: Colin, Joseph, Paul, Amandab, Amandba, Carol. n = 4. So, answer is Amandab!!!! Why you wrote that answer is Paul??

  • DealPete Avatar

    Interesting problem, but I voted it down because of a lot unnecessary annoyances - e.x.

    1. having to parse an input string
    2. having to validate the input
    3. having to sort participants with equal winning numbers
  • frefer Avatar

    234 Aubrey 226 Elizabeth 213 Andrew 192 Chloe 192 Abigail 74 Olivai why its abigail ? why abigail is higher than chloe ? (since c > a ) dunno whats wrong here, help

  • lukeephilips Avatar

    Read the instructions really carefully, there's a lot going on. The bit about adding the length of the array to the name's score before multiplying by the weight is easy to miss.

  • arkada38 Avatar

    The length of the firstname is added to the sum of these ranks hence a number n.

    PAUL -> n = length of firstname + 16 + 1 + 21 + 12 = 4 + 50 -> 54
    length of firstname = 4 not 3

    And random tests will fail (e.g. C#).
    Because ranks are numbered from 0 in tests solution.
    This contradicts to the condition.

  • txwkx Avatar

    The frustration is real. For the first time, I struggled to understand a kata description.

    Would appreciate any help. My logic:

    • Calculate the sum of letters per name
    • Add the length of the name to that sum
    • Multiply the sum by corresponding weight (we) - get the winning number
    • ???

    At what point should I engage the 3rd argument n ?

  • estep Avatar

    This comment has been hidden.

  • TinoC Avatar

    This comment has been hidden.

  • dsimmons87 Avatar

    This comment has been hidden.

  • cmac59 Avatar

    ../home/codewarrior/spec.ts(1,1): error TS1084: Invalid 'reference' directive syntax. ../home/codewarrior/spec.ts(2,1): error TS1084: Invalid 'reference' directive syntax. For typescript.

  • OrBaruk Avatar

    This comment has been hidden.

  • Yuchiko Avatar

    it was a difficult description for me. It would be nice, if you add result array

  • marco.valloni Avatar

    I think that also in PHP there're some issue regarding the sort order of the cases with more than 1 result,

    In one case I obtain "Elizabeth" and "Matthew" and the right one was "Matthew" (So inverse alphabetical order) but in another test with "Abigail" and "Chloe" the right one was "Abigail" (So alphabetical order).

    Can be that there's some mess in the test at this point, with the reverse order I'll pass also all the standard test under the exercise but during the submit there's no way I can find the right sorting.

  • user1055863 Avatar

    I wish the problem statement would be more detailed in describing how the winner is chosen if there are equal ranks. Without checking the discussion thread and test cases, I would not figured out what was wrong in my understanding of the problem.

    In general, the kata is fine and requires you to understand what is the best way to represent the participant records.

  • telepario Avatar

    This testcase is wrong!?

    st: Addison,Jayden,Sofia,Michael,Andrew,Lily,Benjamin / we: 4, 2, 1, 4, 3, 1, 2 / nth: 4 Expected: Benjamin Error. Expected Benjamin but got Addison

  • vporta Avatar

    Wish this kata had better examples and explanation.

  • Art4es Avatar

    Hello, I'm not realy good in English, so can u help me to understand, what is the "n" in input data ("name, name,.. ,name", [weight, weight,.., weight], that n). what should i do with this array: [Addison] => 292 [Jayden] => 130 [Sofia] => 55 [Michael] => 232 [Andrew] => 213 [Lily] => 62 [Benjamin] => 152

    Is it the position in rightly sorted array?

  • Caleb.Avila Avatar

    (JavaScript)

    Hey I tried to make this kata but when the solution is evaluated with randoms say me that the name is wrong, i checked manually and the solution is correctly

    Example:

    Testing Rank: William,Aubrey,Michael, [3,1,6], 2

    Solution:

    [ 348, 258, 78 ] [ 'Michael', 'William', 'Aubrey' ]

    Result:

    ✘ It should work for random tests too - Expected: 'Aubrey', instead got: 'William'

    Note: The problem is only with randoms

  • refede Avatar

    (Python) Hi, I´d like to know, what is the test for this result: ✘ 'Chloe' should equal 'Abigail'

  • johnhalsey Avatar

    Ive completed this Kata but I can't see other peoples solutions. It says I have not completed it!

  • iCombii Avatar

    I'm not sure what his point is with receiving n. The other things with receivng and working with the string and array I understand.

  • docgunthrop Avatar

    I'm hoping to get some clarity as I appear to be having issues producing the correct output when there is more than one name with the same winning number.

    In the description, you state: "When two people have the same winning number sort them alphabetically by their firstnames."

    To clear up any confusion, I modified my code so that the output returns the first name that starts with a letter with a lower rank ("A" = rank 1, "B" = rank 2, etc.), basically in alphabetical order. When that didn't work, I changed it to return the name with a leading character that ranks higher, but I got errors there as well.

    As a last resort, I'm posting this comment to see if I can get some clarification on "alphabetical order".

  • yyyyaaa Avatar

    Yo I think one of the test case is wrong (Ruby) Below are the results I got after submit (run tests step was ok) Shouldn't it be rank 2 Elizabeth? How the hell it is expected to be Matthew? I printed both n and the array values out to check. 4 [["Addison", 264], ["Michael", 204], ["Andrew", 195], ["Benjamin", 136], ["Jayden", 118], ["Lily", 58], ["Sofia", 50]] ✔ Test Passed: Value == "Benjamin" 2 [["Matthew", 450], ["Elizabeth", 440], ["Jayden", 354], ["Natalie", 186], ["Chloe", 129], ["Elijah", 45]] ✘ Expected: "Matthew", instead got: "Elizabeth"

  • htbkoo Avatar

    When I tried to submit my code, the fixed tests failed with an strange message "✘ 5". Does not seem like I break the test since nothing like "Expected: <>, Actual: <>" was printed. Would be great if any hints could be given.

  • user5036852 Avatar

    Really good kata! Thanx!

  • bladez Avatar

    I would really like to get this kata solved but it's impossible without getting any help on my question regarding C# test case. I'd truly appreciate if someone could help with this. I can post my solution here if someone tells me how to do it so that the code formats correctly here.

    Like I said my problem is with this test: test1 Expected string length 6 but was 40. Strings differ at index 0. Expected: "Sophia" But was: "Names and weights array lengths not even" -----------^ at RankTests.test1 () <0x416e9610 + 0x00717> in :0

    I made some console logging and in that specific test case st parameter has five names (Sophia,Robert,Abigail,Grace,Lagon) but we parameter has six items. One of my checks verifies that both must have equal amount of items (if they don't "Names and weights array lengths not even" string is returned). Does the st parameter miss one name or does the we parameter have one weight too much?

  • bladez Avatar

    Hi! I was able to do the sample test run successfully but got this one on submit:

    test1 Expected string length 6 but was 35. Strings differ at index 0. Expected: "Sophia" But was: "Names and weights array lengths not even" -----------^ at RankTests.test1 () [0x00000] in :0

    That seems to have been triggered on my check for names array length and we array length (both should have equal length). I thought for each name there must be an entry in we array. Am I wrong?

  • westfolt Avatar

    When runnning test all passes well, but when submitting solution "unknown error" occures on C#

  • user7261034 Avatar

    Seems I'm doing something wrong. Details specify: "When two people have the same winning number sort them alphabetically by their firstnames." But when I do this a test fails (because it expects reversed order). I change the code accordingly and the test passes. But then another test fails because it expects alphabetical order.

  • TheBMachine Avatar

    Python: 'William' should equal 'Willaim' Typo?

  • pre Avatar

    This comment has been hidden.

  • Insti Avatar

    This might be an interesting test case to add.

    Test.assert_equals(rank("A,B,C,A", [1, 1, 1, 10], 1), "A")
    
  • SpeakerLocke Avatar

    That looks kinda bullshit, when your program runs through all available test without issues, and even runs through test you wrote yourself, but crashes on the hidden ones. After 30 mins you start thinking that hiddens are fucked up.