Using a stack to compare letters in a string

Mar 26, 2015 at 4:44pm
So I have to write a code and must you a stack, to determine if the sequence is is in the form of X^nY^n.
Last edited on Mar 26, 2015 at 7:00pm
Mar 26, 2015 at 5:39pm
I am not sure what is wrong with your code, it seems unnecessarily complicated to me. The only problem I can find is seq[i+1]!='A'. You would be trying to access memory outside the array when i == seq.length() - 1.
Topic archived. No new replies allowed.