Pergunta de entrevista da empresa Wayfair

Given a string of brackets, return if string is valid or not. String is valid if all opening brackets have matching closing brackets. Example: {[()]} = valid {()[]} = valid {[} = invalid

Resposta da entrevista

Sigiloso

26 de ago. de 2016

Push the open bracket onto the stack when you see it, and pop the open bracket off the stack when you see a closing bracket