Developer Interview Questions in Bengaluru | Glassdoor

Developer Interview Questions in Bengaluru

4,738

Developer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Find all anagrams in a file. Improve the running time to O(n).

7 Answers

for each work in the file, sort the letters in the work and add the result into a stack, if there is a collision, the original word is part of set whose words in that set is an anagram. Since adding to a stack only take O(1) and you must visit each word once, the complexity is O(n).

The way I approach anagrams is that I assign a prime number to each letter and then multiply the letters. In theory, ABC gives you say 3 * 5 * 7 = 105 Any anagram will have letters that when multiplied give you 105. In the solution above, it's far more than O(n) because of the sort step which depending on how you're trying to sort could wind up nlogn or n2 or something like that.

I should note that this is generally good to about 9 characters, at which point overflowing becomes an issue and you'll probably want to go to some construct such as BigInteger in Java or go with what Anonymous presented.

Tell me a palindrome date before 10-02-2001 (mm-dd-yyyy)

7 Answers

You have a list of sentences/words. How to find out the sub list that consists of a specific prefix? Ex: input: prefix="he", list = ["hello", "world", "hello world", "hey dude", "galaxy"....] output: ["hello", "hello world", "hey dude"]

4 Answers

In a sequence of alphabets (like aaabbddaabbcc) write a program to find the number of the consecutive alphabets in and print the alphabet and number. example :if input is aaabbddaabbcc then output should be 3a, 2b, 2d, 2a, 2b, 2c

4 Answers

Written test contained 30 questions in 3 sections.. 10 questions each.. 1st section contained basic C aps, pointers, simple SQL statements... 2nd sections contained moderate queries ( like groupby, orderby ) and simple data structure codings like code to add a node to linked list etc...also pointers and string operations.. 3rd section is the tougher one for me.. it had tables to be normalized, and select data from multiple tables.. also write entire program for implementing linked list,etc... i missed 5 questions from this.. total time 90 mins.. time was not enough for me..

3 Answers

convert binary tree to double linked list

3 Answers

Find the longest subarray which consists of numbers that can be arranged in a continuous sequence. For ex- {4,5,1,5,7,6,8,4,1} output-{5,7,6,8,4}.Find the longest.

3 Answers

A question related to some other language...

3 Answers

Sorting Algorithms Optimizations from 2 loops to just 1 loop

5 Answers

You are given an array of numbers. You need to print the length of the maximum continuous sequence that you encounter. For example if input is [3,8,10,1,9,6,5,7,2 ], the continuous sequences are{1,2,3} and {5,6,7,8,9,10} the latter is the longest one so the answer becomes 6. O(n) solution was asked for, assuming you have a hash map which supports O(1) insertion and fetching operations

6 Answers
110 of 4,738 Interview Questions