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.