Ad
  • Custom User Avatar

    Python test cases seem to contradict themselves on duplcation. The simple test cases say we shouldn't allow duplications, ex:

    [['cheese'], ['rat', 'rat', 'tar'], ['star', 'tars', 'tsar']] should equal [['cheese'], ['rat', 'tar'], ['star', 'tars', 'tsar']]

    while the random tests allow lots of duplication, see the ['Mm', 'mM'] failure below

    [['AQipcR', 'ARciQp', 'ARicQp', 'AipcQR', 'ApcQiR', 'QcApiR', 'QpAcRi', 'QpiRcA', 'RQpAic', 'RcApiQ', 'RpiQAc', 'cARiQp', 'cRpQAi', 'pRAciQ'], ['BpUDwoj', 'BpUowjD', 'BwUDopj', 'DoBwjUp', 'DpwUjoB', 'DwoBpjU', 'UpjwoDB', 'UwjopBD', 'jBUwDop', 'oUwDjBp', 'opBjUwD', 'opjUBDw', 'pUjwoBD', 'pjDBoUw', 'pjowUDB', 'poBUjwD', 'wUBjoDp', 'wUjBDpo'], ['BwUDopj', 'DUpBwoj', 'pUjwoBD'], ['CiboySMp', 'MoCpibSy', 'MpSboiCy', 'bCMyiopS', 'ipboySCM', 'oCiSpybM', 'oiMbSpCy', 'oypbCiSM', 'pCMyiobS', 'yiCpoMbS', 'yoCMSibp', 'ypCSbMio'], ['FPcusOuzT', 'FPsOuzTcu', 'FczuTusPO', 'OuPucFszT', 'OuuczFTsP', 'PFOuzucsT', 'PuTFucOzs', 'cFOTPuzsu', 'cTuzuPOFs', 'csuuzTFPO', 'sFuPzuTOc', 'uPOFTczsu', 'uzuFOPcTs', 'zOcFsTuPu', 'zcsPuFOuT'], ['Mm', 'mM']]

    should equal

    [['AQipcR', 'ARciQp', 'ARicQp', 'AipcQR', 'ApcQiR', 'QcApiR', 'QpAcRi', 'QpiRcA', 'RQpAic', 'RcApiQ', 'RpiQAc', 'cARiQp', 'cRpQAi', 'pRAciQ'], ['BpUDwoj', 'BpUowjD', 'BwUDopj', 'DUpBwoj', 'DoBwjUp', 'DpwUjoB', 'DwoBpjU', 'UpjwoDB', 'UwjopBD', 'jBUwDop', 'oUwDjBp', 'opBjUwD', 'opjUBDw', 'pUjwoBD', 'pjDBoUw', 'pjowUDB', 'poBUjwD', 'wUBjoDp', 'wUjBDpo'], ['CiboySMp', 'MoCpibSy', 'MpSboiCy', 'bCMyiopS', 'ipboySCM', 'oCiSpybM', 'oiMbSpCy', 'oypbCiSM', 'pCMyiobS', 'yiCpoMbS', 'yoCMSibp', 'ypCSbMio'], ['FPcusOuzT', 'FPsOuzTcu', 'FczuTusPO', 'OuPucFszT', 'OuuczFTsP', 'PFOuzucsT', 'PuTFucOzs', 'cFOTPuzsu', 'cTuzuPOFs', 'csuuzTFPO', 'sFuPzuTOc', 'uPOFTczsu', 'uzuFOPcTs', 'zOcFsTuPu', 'zcsPuFOuT'], ['Mm', 'Mm', 'Mm', 'Mm', 'Mm', 'Mm', 'Mm', 'Mm', 'mM', 'mM', 'mM', 'mM', 'mM', 'mM', 'mM', 'mM', 'mM', 'mM', 'mM', 'mM']]

  • Default User Avatar

    wow now thats efficient! I solved it in 40 lines

  • Custom User Avatar

    Fixed.

  • Custom User Avatar

    Fixed.

  • Custom User Avatar
  • Default User Avatar

    Cool kata, but there is critical flaw in edge cases tests, where we asserts that
    ["aaA", "Aaa", "aaa"] equals [["aaA", "Aaa"], ["aaa"]].
    It is wrong, the right answer should be [["aaA", "Aaa", "aaa"]], because anagrams are case insensitive by its nature, referring to related Wikipedia article https://en.wikipedia.org/wiki/Anagram :
    "Listen" is valid anagram for "Silent" vice versa, despite that 'l' and 's' letters have different cases in both words.
    Same is relevant for these examples as well:
    "New York Times" = "monkeys write"
    "Church of Scientology" = "rich-chosen goofy cult"
    "McDonald's restaurants" = "Uncle Sam's standard rot"
    and more on. Please fix that test case!

  • Custom User Avatar

    Approved.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    JS: one random test is not enough, and it is a weak one (though not considering the issue raised by farhanaditya below).

  • Default User Avatar

    You can't, because assert.deepEqual([1,2], [2,1]) will fail.

  • Custom User Avatar

    It's 2021 where Node 12 shoud be enabled and assertSimilarUnsorted in preloaded should be removed and replaced with assert.deepEquals

  • Default User Avatar

    The shuffle function is broken. It generates the same string every time.

  • Loading more items...