@Stanislav : I am using 1.7.0, so that's not an issue. The main problem is that substring( ) takes only int parameters(not even long, forget about taking BigInteger objects). Does C++ have a similar function?
@Sumudu : Interesting way to think, it just didn't strike to me in those 2.5 hours, or later. On Mon, May 13, 2013 at 8:05 PM, Sumudu <[email protected]> wrote: > A faster approach could be based around the idea of counting "valid" > substrings ending at each position in the string (here I say "valid" to > mean containing at least n consecutive consonants). > > For a given position e, either there are no valid substrings ending at e, > or there is a position s_0 such that all substrings [s,e] with s <= s_0 are > valid, and all other substrings ending at e are not. If you know s_0 then > the number of valid [s, e] is easy to count. > > By keeping a running count of consecutive consonants, you can keep track > of s_0 as you increase e, giving a linear time algorithm. > > -- > 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 post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-code/-/vUdvyd6bdOcJ. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards, Vaibhav Tulsyan. -- 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 post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
