Ad
  • Custom User Avatar

    eb110 - AABA is a different set of letters with a different set of permutations than ABAB.

  • Custom User Avatar

    I solved the kata by comparing costs.
    If you insert a letter, it implies that you have to delete and add a certain letter: (cost 2)
    If you simply add or delete: (cost 1)
    This is a well known approach called minimum edit distance.
    I passed all tests but the one we are talking about.

    rkacypviuburk to zqdrhpviqslik, cost: 16 because you have to delete and add 8 letters
    rkacypviuburk to karpscdigdvucfr, cost: 12 because you have to delete and insert 5 and also delete 2 letters

    Please correct me if I'm wrong!

  • Custom User Avatar

    I thought you have to "use" all letters - so AABA is missing one "B" letter. Or perhaps my logic if wrong.

  • Custom User Avatar

    It seems words with similar length are preferred. zqdrhpviqslik is the same length as rkacypviuburk.
    I agree with you, karpscdigdvucfr is more similar, but it's just not what this kata wants:

    TERM | WORD | MATCHING PATTERN | SCORE

    rkacypviuburk | zqdrhpviqslik | ---r-pvi----k | -3

    rkacypviuburk | karpscdigdvucfr | karp-c-i--vu--r | 3

  • Custom User Avatar
  • Custom User Avatar

    Write System.out.println(n); inside your function.

  • Custom User Avatar

    Why don't you simply print the input value?