You are not logged in. Please login at to post your questions!


Runtime error here is my code it is giving Runtime error, what to do in such type of errors n how can i eradicate from this code??? Again I m getting the same error in the next problem , in that i m not using a lot more space still it is giving runtime error....Please Do HELP!!!!! here's the code

asked 27 May '13, 23:57

aasthi's gravatar image

accept rate: 0%

edited 28 May '13, 12:13

i m having a look at your code...till then u can see my code(AC) which i just wrote (in c++) for "cleaning up"..!!

This is your corrected code...i changed bufferedReader to Scanner...i did so as there may be empty lines in the input cases so the readLine() function reads that and then when u split then there is no array...also if u dont split then you convert "" to integer which will give number format exception...!!!! In such cases you need to take input carefully!!!

One way is that you keep on reading the input, using readLine(), till it no longer is equal to ""...!!!


answered 28 May '13, 14:21

kunal361's gravatar image

accept rate: 21%

edited 28 May '13, 14:50

@aasthi...assume if the length of the string i.e. n in ur code equals 6...then you are creating a boolean array of 10^(6+2) i.e 10^8 which is not possible...and that will give you a Runtime Error!!!


answered 28 May '13, 10:19

kunal361's gravatar image

accept rate: 21%

edited 28 May '13, 10:20

and it is the same if n==7...u r creating an array of 10^8 cells..which is not possible!!!

(28 May '13, 10:21) kunal3614★

Hello @aasthi,

There are several types of Runtime errors your code can generate and you can read all about them on the FAQ section, here.

Try to look for something in your code which might cause the runtime error and fix it!!

If you can't, then try to rewrite your code with a different approach or different data structure, I guess that might sound silly, but, sometimes, it helps :)

Best regards,



answered 28 May '13, 00:57

kuruma's gravatar image

accept rate: 8%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 27 May '13, 23:57

question was seen: 1,003 times

last updated: 28 May '13, 14:50