Please read the new rule regarding the restriction on the use of AI tools. ×

_12345_'s blog

By _12345_, history, 9 years ago, In English

Hello CodeForces ,, this Problem in SPOJ (EDIST) I've solved it using dynamic programming "Recursion Method" but actually it gives me RTE in Java

The same algorithm Using C++ syntax gives me Accepted

Can You Please Explain How is That Happens? and How to Avoid Such Problem if it Face me in Future ?

  • Vote: I like it
  • -7
  • Vote: I do not like it

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

Auto comment: topic has been updated by _12345_ (previous revision, new revision, compare).

»
9 years ago, # |
  Vote: I like it +16 Vote: I do not like it

Use c++ to avoid this.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    this is not an answer for my question ! I want a solution that doesn't required changing programming language ! thanks

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

      Well, Java is just slower than C++ and there is nothing you can do about it. I guess you can try optimizing your Java code by doing things like using BufferedReader vs. using Scanner. It is just that SPOJ is very strict with time limits that it becomes harder to pass with Java solutions rather than C++ solutions.

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

        But he says he's getting RTE, not TLE. Isn't it just some problem with stack size?