You're taking the length of the string that contains *n*, and making an array of that size.
So if n is 100, you're taking the length of the string "100" and making an array of size 3. You want int n = Integer.parseInt(reader.readLine()); Or better still: Scanner s = new Scanner(System.in); int n = s.nextInt(); On Mon, Mar 9, 2020 at 8:55 AM reachdevi1993 <[email protected]> wrote: > Hi Collin, > The char arrays size cannot be set as n, because n is a string. Thus, I am > taking its length and creating an array of that size. > > On Thursday, 5 March 2020 19:12:27 UTC+5:30, Collin Pearce wrote: >> >> Make the char arrays size n, not n.length > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/74fb5957-9da6-4316-a2cb-cb376a0a5ec1%40googlegroups.com > <https://groups.google.com/d/msgid/google-code/74fb5957-9da6-4316-a2cb-cb376a0a5ec1%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/CAHaiWHMhXxMbghrfSUvNatyYxpnqUJNJECy53qK0vDN5b3UW2A%40mail.gmail.com.
