Lesson 11 of 24

STL Algorithms: sort, reverse और find

10 min 30 XP

<algorithm> आपको तैयार sort, reverse, max_element, min_element, count, find और binary_search देता है; <numeric> accumulate जोड़ता है। एक लाइन, ढेर सारा काम।

Example: edit me and press Run

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

sort() O(n log n) में चलता है। binary_search सिर्फ़ sorted range पर काम करता है।

Challenge

+30 XP

n और n संख्याएँ पढ़ें। अलग-अलग values बढ़ते क्रम में print करें, फिर अगली लाइन पर कितनी अलग values हैं। Input: 7 4 1 4 2 1 9 2 Output: 1 2 4 9 4

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