Stacks are ESSENTIAL for Coding Interviews! | Valid Parentheses - Leetcode 20

preview_player
Показать описание
leetcode, coding interview question, data structures, data structures and algorithms, faang
Рекомендации по теме
Комментарии
Автор

Master Data Structures & Algorithms For FREE at AlgoMap.io!

GregHogg
Автор

Just found this channel and it's like I stumbled onto a gold mine. Thank you for your videos!!

kareem_
Автор

Oooo, clever. I just oearned the stack at the hardware level implementation and sort of loss sight of what it's good for.

parkourninja
Автор

I would use a 2 pointer solution. Using the same dictionary.

homieinthesky
Автор

What about using this (pseudocode):

Function checkValidity():

-For loop for the length of the string
-- replace (), {}, [] with '"" in the original string
-Loop around
-Return string == ""

Techy
Автор

Never gotten a question about this, but I made a lexer once, that could be used for this.

AndrewTSq
Автор

What is this supposed to achieve in bigger projects?

snake
Автор

I have another idea. Take three variables v1, v2, v3... When you encounter open paranthesis, increment v1 by 1 and also, decrement by 1 if it's a closed parenthesis... If the value of v1 ever becomes negative, it's invalid... Like wise do for curly braces and second brackets.

speakingsarcasm
Автор

I have an idea we can solve without a stack as well, just only one parameter number enough.

burhancerit-vk
Автор

Essential for an interview sure...


But what is the practical application? 🙃

Vichion
Автор

Got this asked during an Interview for Microsoft 😅

harrimahlstrom
Автор

I’m not the greatest coder so patience with my dumb question, is this faster than comparing the first to the last. Then second to second to last and so on?

dashdg
Автор

Stuff like this, is why NO ONE wants to work for these companies. Awesome, you can do random stuff. Thanks.

Fly_The_Sky
Автор

What kind of mental desease do you have to have to write your dict like that?

robertsandiford
Автор

A PDA lol, did you know that a PDA corresponds to a context free grammar which would equal S-> epsilon | S(S)

grandmakisses