Balanced brackets
A Swift string mixes ()[]{} and you're checking with a stack whether they nest correctly. When you hit a closing bracket, what comparison do you make?
A Swift string mixes ()[]{} and you're checking with a stack whether they nest correctly. When you hit a closing bracket, what comparison do you make?
Push opening brackets onto the stack; when a closing bracket appears, pop the top and check that it's the opening bracket of the same kind. If the stack is empty or the kinds differ, return false right there.
CS fundamentals and algorithmsShort answerIntro
What's the difference between a stack and a queue?
#stack
CS fundamentals and algorithmsShort answerBasics
You want a stack, like an editor's undo stack, that returns the "current maximum" of the…
#stack
CS fundamentals and algorithmsShort answerIntro
Two singly linked lists may share their tail nodes. How do you find the first node they…
#algorithm
CS fundamentals and algorithmsShort answerBasics
You need to add two base-36 strings made of digits and letters without converting them to…
#string