Interview questions
Software Developer interview questions – page 10
945 questions. Tap “Show answer” to check yourself.
-
Modify this code to find the maximum subtree in tree which is a BST. Maximum subtree means subtree goes upto its leaves from any node. Modify the code again to find the maximum tree which is a BST. BST can lie anywhere and it may or may not go upto its leaves
-
There is code like var i; { .. var j; .. } var k; .. var a; { .. var c; { var i; } .. var d; .. } For simplicity you may assume that there is only one variable declaration on 1 line. Now given a line number, you have to tell what all variables are valid on that line. Propose an algorithm for this
-
Implement LRU cache. Write a code for this. LRU cache supports 3 operations, put(key, value) get(key) remove(key)
-
Implement next_permutation function (similar to what is in algorithm.h)
-
Your future interest, interaction capabilities
-
Given a list of stars and their distances from the earth.Find an efficient solution to find the k closest stars to earth?
-
Write a code to check if a tree is BST or not
-
There are two sorted arrays. First one is of size m+n containing only 'first' m elements. Another one is of size n and contains n elements. Merge these two arrays into the first array of size m+n such that the output is sorted
-
Find square root of a number
-
A simple program to check whether a number is palindrome or not
-
How would you design DBMS for SnapdealÂ's websiteÂ's shoe section. Now if you want to further break it into Sports and Casual Shoe would you break the DB into two or add another entity?
-
Little discussion on Final Year Project and the summer training
-
Basics of DBMS, difference between RDBMS and DBMS, Keys and its types, indices, joins and its types with example, normalization and denormalization
-
What are inner join and outer join in sql
-
A linked list contains loop.Find the length of non looped linked list
-
3 mislabeled jar puzzle.Since i had heard this puzzle many times,i answered it in 2-3 minutes.He said i can make out that you have heard this puzzle already ;)
-
There is four digit number in aabb form and it is a perfect square.Find out the number
-
You have a deck of 10 cards.You take one card out and put it on table and put next card in the end of deck.You repeat this sequence till all cards are on the table.Sequence formed on the table is 1,2,3,4,5Â…10. What was the original sequence of card. After doing some exercise i answered 1,6,2,10,3,7,4,9,5,8
-
There is a file which contains ip addresses and corresponding url. Example 192.168.1.15 www.abc.com 10.255.255.40 http://www.snapdeal.com You have to return the subnet mask of the ip and the url after "www." Output 192.168.1 abc.com 10.19.76 snapdeal.com Write a Java function for that
-
Number of rectangles in MxN matrix
-
All anagrams of a string.He called it anagram but i think he wanted to ask all possible substrings of a string
-
Which Design patterns you have used.I said Decorator,Factory,Singleton.Then he asked about Decorator design pattern
-
Reverse linked list without recursion
-
Two linked list are merging at a point.Find merging point
-
Given an array of elements. We can perform following operation only- Increase an array element. Cost of operation is the amount of increment made per array element. Now for a given H, we need to make any H ( not necessarily consecutive ) elements of array equal with minimum cost. E.g. N=6, H=4 2 3 5 6 4 4 changes to -> 4 4 5 6 4 4 Cost is ( 4-2 + 4-3 = 3 ) N=6, H=3 2 3 5 6 4 4 changes to -> 2 4 5 6 4 4 Cost is ( 4-3 = 1 ) Optimal complexity- O(N)
-
Lowest Common Ancestor of two nodes in binary tree.I wrote code for this.Then interviewer drew a tree and asked to print stacktrace on it
-
You are given two ropes.Each rope takes exactly 1 hour to burn. How will you measure period of 45 minutes
-
Find LCM of all numbers from 1 to n. Give an algorithm, then correctly estimate the time complexity
-
SQL vs NoSQL. Why NoSQL
-
JAVA-Spring and Hibernate