For everyone attempting this solution, discuss here.
What is better, take N as a integer variable or as an array??
I took it as a variable because Google expects the output as soon as they give the input to your program, as you can see in the given sample test case scenario. So, taking all inputs at once into an array and then outputting them later might not work.
how to correct the run time error
how to correct the RE
i tried 2 approaches (both Array and Variable) . both times i get a Run-time Error in submission. but when i intentionally output incorrect answers it just says its incorrect. any solution?
did you test it on local so that there are no errors in your code?
i did. it worked flawlessly on local.
just now tried a third method and passed.