Ad
  • Default User Avatar

    Holy shit, you're fucking incredible!

  • Custom User Avatar

    The output should be one or 2 characters by removing the same amount of characters from left and right. d is the number to remove from left (or right). n is what is left after removal.

    To get the d expression it's easier to look at some examples.

    "1"      -> "1"  (l = 1, d = 0)
    "12"     -> "12" (l = 2, d = 0)
    "123"    -> "2"  (l = 3, d = 1)
    "1234"   -> "23" (l = 4, d = 1)
    "12345"  -> "3"  (l = 5, d = 2)
    "123456" -> "34" (l = 6, d = 2)
    

    From here it's hopefully easy to come up with any suitable formula that gives you this property. I used (l - 1) / 2 :)

  • Custom User Avatar

    How did you get this formslas for d and n???!