Map in STL is used to hash key and value. We generally see map being used for standard data types. We can also use map for pairs.
For example consider a simple problem, given a matrix and positions visited, print which positions are not visited.
(0, 1) (0, 2) (1, 2) (2, 0) (2, 1)
This article is contributed by Abhishek Rajput. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Given an array of pairs, find all symmetric pairs in it
- Pairs with Difference less than K
- Count all pairs with given XOR
- C# | How to add key/value pairs in SortedList
- Summation of GCD of all the pairs up to N
- Sum of XOR of sum of all pairs in an array
- Count pairs with Odd XOR
- Print all pairs with given sum
- Count pairs with given sum
- Sets of pairs in C++
- Sum of bit differences among all pairs
- Sum of XOR of all pairs in an array
- Count number of pairs (A <= N, B <= N) such that gcd (A , B) is B
- Number of ordered pairs such that (Ai & Aj) = 0
- Sum of f(a[i], a[j]) over all pairs in an array of n integers