Ad
  • Custom User Avatar
  • Custom User Avatar

    Yup, that's the math way to do it.

  • Custom User Avatar

    Hello, thank you for your answer.

    I just saw the example tests:

    names1 = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"]
    r1 = 1
    res1 = "Sheldon"
    names2 = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"]
    r2 = 6
    res2 = "Howard"
    names3 = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"]
    r3 = 10
    res3 = "Penny"
    Test.assertEquals(whoIsNext(names1, r1), res1)
    Test.assertEquals(whoIsNext(names2, r2), res2)
    Test.assertEquals(whoIsNext(names3, r3), res3)

    Your ruby and java version have r=6 , res=Sheldon indeed, maybe it's a cache thing or something because it has been a while since I've tried to solve it.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution