How to compare certain content of 2 stacks? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to compare certain content of 2 stacks?

Stack: ABBA madam evol im Queue: mi love madam ABBA how to compare ABBA from stack and ABBA from queue?

27th Sep 2020, 5:16 AM
denise
1 Answer
+ 4
Assuming you have stack/queue of chars, you might write a loop that consumes one element from each container, and compares them one by one. If there is any difference, break the loop.
27th Sep 2020, 5:19 AM
Tibor Santa
Tibor Santa - avatar