Arrays and hashing interview questions
Counting, frequencies, prefix sums, duplicates and anagrams.
9 questions solved with this pattern, most asked first. Reported by candidates in public interview write-ups and reworded by Scrivio. How the reports are counted
Your progress: 0 of 9 done, 0 saved
Find the second largest element in an array.
Reported 52 times
Read the solutionArrays and stringsExample sources
3 of the write-ups counted: geeksforgeeks.org 2014, geeksforgeeks.org 2021, geeksforgeeks.org 2014
Find the first character in a string that does not repeat.
Reported 35 times
Read the solutionHashing and hash mapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2024, geeksforgeeks.org 2023, geeksforgeeks.org 2018
Count the pairs of elements in an array that add up to a target sum.
Reported 34 times
Read the solutionHashing and hash mapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2023, geeksforgeeks.org 2020, geeksforgeeks.org 2020
Group the words of a list so that anagrams are together.
Reported 28 times
Read the solutionHashing and hash mapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2020, geeksforgeeks.org 2021, geeksforgeeks.org 2019
Identify the values that occur more than once in an array.
Reported 22 times
Read the solutionHashing and hash mapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2023, geeksforgeeks.org 2026, geeksforgeeks.org 2020
Rotate an array to the right by k positions.
Reported 22 times
Read the solutionArrays and stringsExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2013, geeksforgeeks.org 2021
Determine whether an array has two elements whose sum is K, and return them.
Reported 19 times
Read the solutionHashing and hash mapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2013, geeksforgeeks.org 2017, geeksforgeeks.org 2017
Explain an algorithm that counts how often each element appears in an array.
Reported 16 times
Read the solutionHashing and hash mapsExample sources
3 of the write-ups counted: geeksforgeeks.org 2020, geeksforgeeks.org 2023, geeksforgeeks.org 2025
Build an array where each position holds the product of all other elements, without using division.
Reported 16 times
Read the solutionArrays and stringsExample sources
3 of the write-ups counted: geeksforgeeks.org 2024, geeksforgeeks.org 2020, geeksforgeeks.org 2019