Implement a function to validate whether a given binary tree is a BST (i.e. write an isBST() function).
Software Development Programmer Interview Questions
33,153 software development programmer interview questions shared by candidates
Given an integer set of numbers, print all the subsets. For some reason the interviewer asked to print the supersets, but what he means is subsets.
An optimal algorithm to check whether a hand of cards was a full house (in Poker) or not.
This was not unexpected but a bit difficult. How would you represent the ordering of a deck of card if you only have 32bytes to work with. So, he explained that you have 52 objects, there are 52! possible ordering of them. how to encode one of those ordering within 32 bytes?
Milestone 2) Will ask to optimize by reducing the number of unfulfilled orders. The apis will be confusing and you will have two interviews during the coding session.
Consider a stack of N number of cards which are piled up and in facing down. Each card has a unique number from the range 1 to N. The card is stacked in such a way that it exhibits the following behavior: Take the first card and put it under the stack without revealing. Now the next card on the top will have the number 1 on it. Next take 2 cards one after the other and put is under the stack without revealing. Yes you guessed it right - the next card on the top will reveal a value of 2. This goes on. Eg. for such a series : 9,1,8,5,2,4,7,6,3,10 [for N=10] Write a program to generate such a series for a given N number of cards so that this behavior can be exercised.
In a given sorted array of integers remove all the duplicates.
Given a binary tree with the usual left and right pointers on each node, and additionally a parent pointer, make an algorithm to discover the closest ancestor to 2 nodes on the tree.
"Solve a maze", you have a 2D matrix with 1's as blocked and 0's as path. Find a path from one corner to another, backtracking should be allowed.
I was asked two questions. Q 1. You are given two version numbers of a software, like Version 10.3.4 and Version 10.3.41. Write a program to find out which of the version numbers are the latest. If version 1 is latest output -1, if version number 2 is latest output +1 else output 0 if same version. Both the version numbers are taken as string. He also asks to make the program of minimum time complexity as we can. At the end he also asked the difference between an iterative program and one with recurrence and their advantages and disadvantages. Q 2. Given two files with a list of application IDs (or some kind of data) stored in them , write a program to compare the data in the two files and output all the common data found in each. What data structure would you use and why ? Give a minimum time and space complexity algorithm. Why did you choose the particular data Structure or algorithm ?
Viewing 31 - 40 interview questions