Ad
  • Custom User Avatar

    your approach is totally wrong. Not an issue.

  • Custom User Avatar

    Description updated

  • Custom User Avatar

    looks like java is not your language
    StackOverflowError :)

  • Default User Avatar

    When no upper bound is given, you should assume the numbers may run up to an indefinite number of digits.

  • Custom User Avatar

    No.

    After 1e5, it asks for one more result, zeros(1e9).

    Your solution has to be O(log n), not O(n).

  • Default User Avatar

    I think what's happening is that your code is appending the last vowel in your list to characters beyond the alphabet. Try building a test case or two that cover such cases.

    I just added an example test case to cover accented characters. Here's the Java version of the new example test case...

    @Test
    public void tt5() {
      String a,x;
      a = Main.toexuto("José is a garçon at a café in the cañón.");
      x = "Jiosoé iso a gearoçoni ato a caafeé ini tohee caañóni.";
      assertEquals(x, a);
    }
    

    Note: Not a spoiler... just an example test case. :)

  • Default User Avatar

    I took a look at your solution. Your issue is the static int ans. Because is it global, when the other tests execute, ans is never reset to 0 again. I slightly changed your code and all the tests pass with this modification:

    if(String.valueOf(n).length() == 1) {
        int tmp = ans;
        ans = 0;
        return tmp;
    }
    

    It is not pretty, maybe you want to modify your recursion to not use a global.

  • Default User Avatar

    OK, had a look at the Java test cases and I can't seem to see anything wrong with it. For your case, with 39 this is the actual test: assertEquals(3, Persist.persistence(39)). So it is expecting 3 given the input of 39. If it fails all the tests, then there must be something up with your solution. You can send me your code but then mark your comment as spoiler so I can have a look for you.

  • Default User Avatar

    I'm the original author and only created the Javascript solution. Let me have a look to see what's up.

  • Default User Avatar

    Which language are you using for the kata? Does it fail in the Initial Tests or Random tests section?