Solving Meta's 2022 Most Asked Interview Question

preview_player
Показать описание
Meta's most asked coding interview question in 2022 is the problem "Minimum remove to make valid parentheses". The problem involves the use of a stack and set data structure.

Check out my interview prep platform for learning the patterns!

Рекомендации по теме
Комментарии
Автор

At 4:22, I think we need to pop from stack item 4, not item 2. Great video as usual!

hnkien
Автор

I haven’t seen yet but you are the best, just come from your triangle problem, love your videos ❤ please upload more❤

clot
Автор

Great explanation! It should be emphasized that "set" here really means a hash table data structure (line 4 in the code). One might be tempted to use a set that's ordered, e.g. std::set in C++ which implements a binary search tree, rebalancing itself with each insert/erase/find. While the latter could be used and would still achieve correctness, it would do so at O(log(N)) vs. the former which does it at O(1). In other words, overall complexity with an ordered set would be much worse at O(N log(N)), after the usual dropping of constants

DominikLoeffler
Автор

what platform did you use to code and run the solution? thanks great video BTW

JackAbou
Автор

Add two closing parentheses on the end of the string being parsed and it breaks this algorithm.

Gangrelguy
Автор

What about "Foo(bar))(". That's valid since the number of ( matches the number of )

MrTarekradi
Автор

Good explanation. Is converting the string to an array necessary? Strings in C#/Java also have indeces.

EMdragonKnight
Автор

you say stack but I see (FIFO) queue at 4:20

correabuscar
Автор

Theres a space o(1) solution thats expected

destiny-fox
Автор

I do not think that it will work on all string variations.

zaza.javakhishvili
Автор

Hi muinos....I am from India....please make more video.... 😎

sameer
Автор

stack.pop is char and how this is being added to set of integers..at line 16

vinayyelleti