Lesson 14 of 24

set, stack, queue और priority_queue

11 min 35 XP

set अद्वितीय sorted values रखता है। stack last-in-first-out (LIFO) है, queue first-in-first-out (FIFO), और priority_queue सबसे बड़ी value हमेशा ऊपर रखता है।

Example: edit me and press Run

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.

Balanced brackets stack का क्लासिक interview सवाल है: खुलने वाले brackets push करें; बंद होने वाले bracket पर top का मेल जाँचें और pop करें।

Challenge

+35 XP

Brackets ((), [], {}) की एक string पढ़ें। हर bracket सही क्रम में बंद हो तो "Balanced", वरना "Not balanced" print करें। Input: {[()]} → Output: Balanced

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.