Arrays and strings interview questions
13 questions on this data structure, most asked first. Reported by candidates in public interview write-ups and reworded by Scrivio. How the reports are counted
Your progress: 0 of 13 done, 0 saved
Find the second largest element in an array.
Reported 52 times
Read the solutionArrays and hashingExample sources
3 of the write-ups counted: geeksforgeeks.org 2014, geeksforgeeks.org 2021, geeksforgeeks.org 2014
Merge two sorted arrays into one sorted array.
Reported 47 times
Read the solutionTwo pointersExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2019, geeksforgeeks.org 2017
Write a program that outputs a string's characters in reverse order.
Reported 45 times
Read the solutionStrings and triesExample sources
3 of the write-ups counted: geeksforgeeks.org 2024, geeksforgeeks.org 2024, geeksforgeeks.org 2024
Reverse the order of the words in a sentence.
Reported 45 times
Read the solutionStrings and triesExample sources
3 of the write-ups counted: geeksforgeeks.org 2021, geeksforgeeks.org 2020, geeksforgeeks.org 2017
An array holds the numbers 1 to n with one missing. Find the missing number.
Reported 43 times
Read the solutionMath and bitsExample sources
3 of the write-ups counted: geeksforgeeks.org 2024, geeksforgeeks.org 2019, geeksforgeeks.org 2016
Sort an array that holds only the values 0, 1 and 2 in a single pass.
Reported 41 times
Read the solutionTwo pointersExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2018, geeksforgeeks.org 2024
Find the length of the longest substring with no repeated characters.
Reported 38 times
Read the solutionSliding windowExample sources
3 of the write-ups counted: geeksforgeeks.org 2023, geeksforgeeks.org 2023, geeksforgeeks.org 2014
Determine whether a given string reads the same forward and backward.
Reported 31 times
Read the solutionStrings and triesExample sources
3 of the write-ups counted: geeksforgeeks.org 2023, geeksforgeeks.org 2021, geeksforgeeks.org 2016
Find the smallest substring of a string that contains every character of another string.
Reported 31 times
Read the solutionSliding windowExample sources
3 of the write-ups counted: geeksforgeeks.org 2020, geeksforgeeks.org 2017, geeksforgeeks.org 2017
Rotate an array to the right by k positions.
Reported 22 times
Read the solutionArrays and hashingExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2013, geeksforgeeks.org 2021
Find the next larger number that uses exactly the same digits as a given number.
Reported 19 times
Read the solutionMath and bitsExample sources
3 of the write-ups counted: geeksforgeeks.org 2017, geeksforgeeks.org 2017, geeksforgeeks.org 2024
How many substrings of a given string are palindromes? Count them.
Reported 18 times
Read the solutionStrings and triesExample sources
3 of the write-ups counted: geeksforgeeks.org 2024, geeksforgeeks.org 2024, geeksforgeeks.org 2022
Build an array where each position holds the product of all other elements, without using division.
Reported 16 times
Read the solutionArrays and hashingExample sources
3 of the write-ups counted: geeksforgeeks.org 2024, geeksforgeeks.org 2020, geeksforgeeks.org 2019