mahmoud_arafa's blog

By mahmoud_arafa, history, 5 years ago, In English

Hello, I am solving a problem on Hackerrank and I got WA.

Here is the problem link.

and here is my submission.

Could you help me please with a test case as the tests that my code fails for are very large?

Thanks.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it +8 Vote: I do not like it

I could not read your submission because it belongs to your account. You can check the following link.

My accepted C++14 solution

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Sorry, I updated my submission link.

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Ok. I can read your submission now. Your approach is correct. You just need to insert the following couple of lines after line 52 inside the for-loop.

      if (ans >= 1000000007LL)
          ans -= 1000000007LL;