Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output the missing integer #116

Open
tkellehe opened this issue Mar 29, 2017 · 0 comments
Open

Output the missing integer #116

tkellehe opened this issue Mar 29, 2017 · 0 comments

Comments

@tkellehe
Copy link
Owner

tkellehe commented Mar 29, 2017

Output the missing integer

My answer

8 bytes

ɲdFḶṡạĖ⁻

Try it:)


How it works

ɲdFḶṡạĖ⁻
         # Input implicitly pushed onto the stack.
ɲd       # Pushes the string "0123456789" onto the stack.

  FḶṡạĖ⁻ # Loops nine times removing digits from the string "0123456789" producing the missing number.
  F      # Pushes the string "F" onto the stack.
   Ḷ     # Consumes the string "F" and converts to a base 98 number producing 9 then loops the following that many times.
    ṡ    # Swaps the string "0123456789" with the input on the stack.
     ạ   # Gets the ith element from the input and pushes it onto the top of the stack.
      Ė  # Grabs the string "0123456789" at the bottom of the stack and puts it at the top.
       ⁻ # Removes the element pulled out of the input from the string.
         # Implicit end of the loop.

         # Implicit push to the screen, outputting the missing digit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant