0% found this document useful (0 votes)
199 views2 pages

Set and Map: Basic Level Questions

The document discusses implementing a Map class using arrays or vectors that can perform insertion, deletion, finding, and getting a random value in O(1) time complexity. It also provides links to solutions for array and string problems, such as finding the only repetitive number between 1 to n-1, checking if a linked list contains a pair with a given product, and determining the largest subset of an array satisfying a given condition. Fifteen different array and string problems are listed with links to detailed solutions.

Uploaded by

ganesh kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
199 views2 pages

Set and Map: Basic Level Questions

The document discusses implementing a Map class using arrays or vectors that can perform insertion, deletion, finding, and getting a random value in O(1) time complexity. It also provides links to solutions for array and string problems, such as finding the only repetitive number between 1 to n-1, checking if a linked list contains a pair with a given product, and determining the largest subset of an array satisfying a given condition. Fifteen different array and string problems are listed with links to detailed solutions.

Uploaded by

ganesh kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Set and Map

Basic Level Questions:


• Implement a class Map using arrays or vectors, which performs the
following operation in O(1) Time Complexity:
o Insert
o Delete
o Find
o GetRandom (gets you any random value from the ones which are
present inside the map currently)

• Find the only repetitive number between 1 to n-1


[Follow here: https://www.geeksforgeeks.org/find-repetitive-element-1-n-
1/ ]

• Difference between set, multiset, unordered_set, unordered_multiset.


[Follow here: https://www.geeksforgeeks.org/difference-set-multiset-
unordered_set-unordered_multiset/ ]

• Find the only element that appears “b” times


[Follow here: https://www.geeksforgeeks.org/find-element-appears-b-
times/ ]

• Remove Duplicate or Repeated words from String


[Follow here: https://www.geeksforgeeks.org/remove-duplicaterepeated-
words-string/ ]

• Find total no. of distinct years from a string


[Follow here: https://www.geeksforgeeks.org/find-total-number-of-
distinct-years-from-a-string/ ]

• Equally divide into 2 sets such that one set has maximum distinct elements
[Follow here: https://www.geeksforgeeks.org/equally-divide-into-two-
sets-such-that-one-set-has-maximum-distinct-elements/ ]

• Check if a pair with given product exist in a Linked List


[Follow here: https://www.geeksforgeeks.org/check-if-a-pair-with-given-
product-exists-in-linked-list/ ]
• Check loop in linked list and remove the loop using map
[Follow here: https://www.geeksforgeeks.org/detect-and-remove-loop-in-
a-linked-list/ ]

• Count of pairs between 2 arrays such that the sums are distinct
[Follow here: https://www.geeksforgeeks.org/count-of-pairs-between-
two-arrays-such-that-the-sums-are-distinct/ ]

• Kth missing element in an unsorted array


[Follow here: https://www.geeksforgeeks.org/k-th-missing-element-in-an-
unsorted-array/ ]

• Number of Strings that satisfy the given condition in the link below
[Follow here: https://www.geeksforgeeks.org/number-of-strings-that-
satisfy-the-given-condition/ ]

• Number of ways to choose an integer such that there are exactly “k”
elements greater than it in the given array
[Follow here: https://www.geeksforgeeks.org/noble-integers-in-an-array-
count-of-greater-elements-is-equal-to-value/ ]

• Number of unique pairs in an array


[Follow here: https://www.geeksforgeeks.org/number-of-unique-pairs-in-
an-array/ ]

• Largest Subset possible for an array satisfying the given condition in the
link below:
[Follow here: https://www.geeksforgeeks.org/largest-sub-set-possible-for-
an-array-satisfying-the-given-condition/ ]

• Check if the array has an element which is equal to product of remaining


elements
[Follow here: https://www.geeksforgeeks.org/check-if-the-array-has-an-
element-which-is-equal-to-product-of-remaining-elements/ ]

• Find if array has an element whose value is half of array sum.


[Follow here: https://www.geeksforgeeks.org/find-if-array-has-an-
element-whose-value-is-half-of-array-sum/ ]

You might also like