6 kyu

Diagonal Strings

82 of 254frkn2076
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • mlordmailbox@gmail.com Avatar

    Why not take just a little more time and clear up such a messy description.

  • qrt88 Avatar

    What a mess. Let me know if I got this right:

    We're supposed to sort the array alphabetically. Then take the diagonal string. Put the first string to the back of the array. Repeat until all strings have been in the front. Sort the new diagonal array to the same configuration as the original array. Return diagonal array.

    If this is the case, What determines the original configuration? Whichever word we took the 1st letter from? Say input is: { "def", "abc", "ghi" }, then after sorting it would be { "abc", "def", "ghi" }. Then the diagonal array should be { "aei", "dhc", "gbf" } before setting it to the original configuration. So the output should be { "dhc", "aei", "gbf" }?

    Edit: Got it :)

  • UlrichBerntien Avatar

    In languages (like Go) with UTF-8 strings (variable number of byte per character):

    Add a test case with a 2 byte character (like ± or 🌹) in the string. Solutions with byte access despite the structure of UTF-8 strings will fail the test.

  • Blind4Basics Avatar
    • one single random test isn't enough (JS at least), and needs to test different sizes too
    • invalid inputs aren't tested in the random tests either
  • Blind4Basics Avatar

    the description is just... horrible :s

    • the examples rely on implementation details (shifting stuff), and the way it's displayed is especially misleading (in a 2x2 layout)
    • the task should be given before the example. For now, this seems to be the task, when reading the description: You must first sort the array alphabetically. And output consists of letters obtained diagonally (from upper left to lower right). while it's not that at all......
  • SolitudeRain Avatar

    maybe 4kyu.

  • dp_smart Avatar

    Test 6 C#. array.len = 5. word.len = 5.

    Expected and actual are both <System.String[5]> Values differ at index [0] Expected: null But was: "jPADP"

    ??

  • Amoyah Avatar

    Hello, I've a problem, I pass all tests except test 6. The error message is expected "[ Array(5) ] to deeply equal [ Array(5) ]", I want to be able to see the expected value, so I can be able to my the code.

    javascript

  • BIl345 Avatar

    Hello there! I pass all tests except one random test (RandomTest3). But I am extremely confused by his answer:

    Expected: [null, null, null, null, null] Actual: ['zIXkS', 'zIXkS', 'zIXkS', 'zIXkS', 'zIXkS'] Which: was 'zIXkS' instead of at location [0]

    How can there be such an answer as indicated in this test?

    Language Dart

  • Investrum Avatar

    Need a test like ['xyz', 'abc', 'xyz'] My solution passed all the current tests, but it wouldn't have passed this one.

  • eb110 Avatar

    I think the description should to say "if array.Length == 0 return null" as from some point of view it can be treated as a square...which size is 0 ;p

  • dlcoe Avatar

    This kata is harder than a 6 because of the requirement that we must sort the input alphabetically and then sort back into the default order, while the original can have duplicates. This Kata doesnt have much of an explanation, and is mostly an excercise in figuring out what we are supposed to do based on the examples.

    It would be a much better kata if there was some sort of real life analogy or situation. I cannot think of any way that would make sense with the duplicates and re-sorting.

    The description should probably state this additional information: Sort the strings in alphabetical order. Rotate through each of the strings being the first, while keeping the strings in the sorted order. Find the diagonal from upper left to lower right. We need to find the diagonal rotating through each of the strings being the first string.

    For the first test, the very first array diagnol expected back in your answer array is: abcd
    kata
    qwer
    1234 -> abcd => "aae4"

    That order looks quite arbitrary to me without explanation of the rotation.

  • Unnamed Avatar

    Tests with non-unique strings needed.

  • Voile Avatar

    Needs random tests.

  • Voile Avatar

    Need sample tests.