Skip to content

Commit

Permalink
STL ->Save Time
Browse files Browse the repository at this point in the history
Important Standard Template Library Functions to Save Time during Contests in CP
  • Loading branch information
kamlesh012 authored Jul 23, 2021
1 parent 06c7fb9 commit b4dfef2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions STL
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//Part of #include <algorithm>
Important STL Functions to save Time

1->max({a, b, c, d}); ->Max of multiple elements
2->max_element(start, end) ->max in range
3->count(begin, end) ->just as name
4->accumulate(begin, end) ->sum of elements in range

5->merge(range1 begin , range1 end, range2 begin, range2 end) ->merge two sorted ranges.

6->unique(.begin(), .end()) ->removes consecutive duplicates only.
*Does not change container size.Just returns iterator to the new size.

Read more at cpluscplus.com

Containers->

map
unordered_map

multimap
unordered_multimap

set
multiset

unordered_set
unordered_multiset

0 comments on commit b4dfef2

Please sign in to comment.