Ad
  • Custom User Avatar

    well done xD

  • Custom User Avatar

    That's because you're using arrays, and some numbers in tests go up to trillions, so you run out of space for all elements. Try to think of another approach entirely.

  • Custom User Avatar

    Just imagine what you would do if this were asked in a maths exam... hope that helps.
    You can also paste your code directly into the discourse usging three back ticks(`):

    like this!
    

    See here for more.

  • Custom User Avatar

    It's not about speeding up code per say; it's about finding an approach that works just as fast for small numbers as big ones.
    Also have a read below.

  • Custom User Avatar

    There's no need for brute force, use your head and think how using arithmetic you can get one number from another.