Hi, I am trying to solve Forgone from qualification round of Code Jam 2019 - link <https://codingcompetitions.withgoogle.com/codejam/round/0000000000051705/0000000000088231>
But the solution is always throwing Runtime Error. I tried optimising as much as I could understand. I believe, I am missing something trivial. Can anybody check this and let me know where I am going wrong: import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; class Foregone { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System. in), 32768); PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int T = Integer.parseInt(reader.readLine()); for (int i = 1; i <= T; i++) { String n = reader.readLine(); char[] a = new char[n.length()]; char[] b = new char[n.length()]; int sz = n.length(); for (int j = 0; j < sz; j++) { if (n.charAt(j) == '4') { a[j] = '2'; b[j] = '2'; } else { a[j] = n.charAt(j); b[j] = '0'; } } writer.println("Case #" + i + ": " + (new BigInteger(new String(a))) + " " + (new BigInteger(new String(b)))); } writer.close(); } } -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/1ff0b8ff-65c5-4022-8a17-ecfb111bf687%40googlegroups.com.