LAUNCH SALE 50% off every pass

See plans →

Free sample week

Learn five DSA topics through daily lessons and practice, then revisit what you learned in a timed rehearsal.

35 to 45 minutes a day5 topics · 2 practice problems a day
New to programming? Start with the basics.
Day 5 / 745 min

Keep the next closer on top

Use a stack when the most recent unfinished item must be handled first.

Learn the concept

Choose LIFO or FIFO order on purpose, then use a stack to find each next greater value in one pass.

Open the lesson Watch Valid Parentheses

Practice

  1. 01 · LeetCode
    Valid Parentheses
    LeetCode statement

    Valid Parentheses

    Loading the statement…

    Chapter practice
  2. 02 · LeetCode
    Implement Queue using Stacks
    LeetCode statement

    Implement Queue using Stacks

    Loading the statement…

    Chapter practice

Recall without notes

Explain why ([)] fails even though the bracket counts match. Then trace an empty string and an early closing bracket.

Day 5: Keep the next closer on top.

Plan your next weeks

Choose your schedule and daily target in Study Sprints to preview a longer course with practice and review.

Esc
↑↓Move ↵Open Ctrl↵New tab >Actions ?Shortcuts

Keyboard shortcuts

Anywhere

Open search
CtrlKor /
Show these shortcuts
?
Close a window or menu
Esc

In search

Move through results
↑or ↓
Open the result
↵
Open in a new tab, or a problem on its judge
Ctrl↵
List actions only
>
Remove the filter
⌫

Go to

Learn
GthenL
Practice
GthenP
Assessments
GthenA
System design
GthenS
Companies
GthenC
My profile
GthenM
Today's quest
GthenT
Home
GthenH

Report a bug

Page