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 করুন, তারপর পরের লাইনে কতগুলো আলাদা value আছে। 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.