Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • 538615?v=3

    This comment is hidden because it contains spoiler information about the solution

  • 18488395?v=3

    Python's three tests seems wrong, my code is right but can't pass :)

  • Profile-pic

    So unnefficient for large values of n1 or n2 :/

  • Profile-pic

    Hi, can someone help me figure out why my code fails the 7th test?

    The test expects the output [3,1,2] and my code returns [3,2,1]. I don't know what kind of data the 7th test is sending, therefore I am having a hard time optimizing my code to handle given case.

    (SPOILER) Here is my code in JavaScript:

    function ranks(a) {
        var sorted = []; // The array "a" in decreasing order
        var rank = []; // Copy of original array to be converted to a rank
        // Loops to copy each element of "a" into "sorted" and "rank"
        for (var j = 0; j < a.length; j++){
        // Sorts in increasing order and then reverse to get decreasing order
      // Loops through elements of "rank" and replaces each element with the rank (indexOf sorted)
      for (var i = 0; i<rank.length; i++){
        rank[i] = sorted.indexOf(rank[i]) + 1;
      // Return the ranked array
      return rank;
  • Profile-pic

    Same here! I knew it didn't look quite right, and your correction put me on the correct path. Thanks!

  • Profile-pic

    Good Kata. I enjoyed refactoring to whittle down the code.

  • Profile-pic

    If n1 and n2 both are large numbers.
    Does it take a long time for calculating by pow()?

  • Profile-pic

    Can the array be a tuple or a list of tuples as well, or can we assume it is a list? I don't know what I am missing. My code seems to work offline for all lists, but then there must be hidden cases.

    To add....I only see three test cases. Is this as intended? Some of the discussions I am seeing mention a higher number of test cases.

  • 959757?v=3

    quite cool :) I never noticed pow() had a third argument and didn't even think to look since I always use **!

  • 1628077?v=3
  • Profile-pic
  • Profile-pic

    In some parts of the world you might still find circluar analog clocks with hour, minute, and second hands.

    Does it mean there's already none somewhere?

  • 15306903?v=3

    Thank you for leaving this template. I used this example and was able to submit my Javascript solution.

  • 1935752?v=3

    This is very tidy. Nicely done!

  • 4035219?v=3

    Observation (3) is actually not an issue. I got confused. I was talking about situation when player doesn't play every day. It is checked by test case 'can detect an unknown player', on which i stumbled. Yesterday for some reason it seemed that this case is not specified in instructions. But actually it is clearly specified in '(1) that each golfer plays exactly once every day' (c). Sorry.

    About the case of empty list. Adding test case indeed is not necesary. Addressing that case in instructions is enough. Which you did. Thank you.

  • Loading more items...