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.