Ad
  • Custom User Avatar

    I will try. Looking at the number we can see the smallest digit is 1 which appears in the number in several places, at positions 6,7 and 10 using 0 based indexing.
    We choose the the last occurence of the minimumal digit to find the smallest number, so we can tranformer the number say to an array or string to using the built in
    method lastIndexOf()

  • Custom User Avatar

    Shift right (you move every character one position to the right, the rightmost char of the string enters from the left):

    niv <- original string
    vni (1)
    ivn (2)
    niv (3)
    vni (4)
    ivn (5)
    niv (6)
    vni (7)
    ivn (8)
    niv (9)
    vni (10)
    

    It's like this

  • Custom User Avatar

    That's because fianl number, 18786300289, is smaller than 18786302809. You need to get the smallest number possible, the smallest index is a secondary criterion in case there are multiple ways to get the smallest number.

  • Custom User Avatar

    18786300289 < 18786302809

  • Custom User Avatar

    I just did, it's an empty string.

  • Custom User Avatar

    No, it's not, and next time mark your post as having spoiler content.

    At least one character ("" is not valid)

    Check that. Your function returns true.

  • Custom User Avatar

    Leap years are handled by the Date objects automatically, e.g. you can get the date of 29.02 of 2016.

  • Custom User Avatar

    Make sure the object itself is immutable, not only its properties