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 എപ്പോഴും ഏറ്റവും വലുത് മുകളിൽ വെക്കുന്നു.

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.