Friday, July 31, 2015
Tuesday, July 28, 2015
Monday, July 27, 2015
Thursday, July 23, 2015
Tuesday, July 21, 2015
Sunday, July 19, 2015
Friday, July 17, 2015
CareerCup: New Interview Question for
Suppose you have a 2 stream of integers. How would you randomly select a sample of size N, with equal probability?
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
A single-elimination tournament with 64 teams. Before the tournament, fans construct fantasy brackets for their tournament predications. Design a data structure for storing fan brackets and algorithm to score their brackets against a winning bracket. Assume we will then need to quickly score a player’s predictions (1 point per successful round prediction) and your solution should be optimal enough to handle millions of fan brackets with minimal data.
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Design a data structure that supports kind of full text search but in numbers.
We are given file with lot of 10-digits numbers, for example:
1234 567 890
4124 123 123
3123 123 322
On a given number X we should return all numbers that contain X.
For example, if the number 123 was given, we should return all numbers (from the list above) because 123 is in all of them.
If the number 41 was given we should return only the middle number - because the number 41 is only in it.
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Given an unbalanced binary tree, write code to select a node at random (each node has an equal probability of being selected).
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Find a duplicates in an array of length n. The values are positive integers in the range between 1 .. n-1
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
You have an array of integers. Each integer in the array should be listed three times in the array. Find the integer which does not comply to that rule.
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Count triangles in an undirected graph where a triangle is a unique set of three vertices connected to one another.
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
In 5 minutes write a code which checks if a given number is a power of two.
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Check if two given words are anagrams of each other.
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Given two sorted arrays find the element which would be N-th in their merged and sorted combination.
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Given a BST with unique values find in a given tree a value closest to a given value X.
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Passing objects and correct the program:---
class OdemoA
{
int i,j;
void function1(int i)
{
System.out.println(i);
System.out.println("Inside function()");
}
void function2(Area a1)
{
if(a1!=null)
{
a1.i=203;
a1.j=115;
}
System.out.println(a1);
System.out.println("end of function2()");
}
public static void main(String args[])
{
OdemoA d1 = new OdemoA();
Area a2 = new Area();
d1.function2(a2);
System.out.println(a2.i);
System.out.println("end main");
}
}
by via CareerCup RSS Feed
CareerCup: New Interview Question for
A client wants to build a software phone book that contains everyone in the world (7 billion people). Every person has only the first name and the name is unique. What data structure would you use to store the data?
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Given a MxN grid, like :
{{{111 111
111 or 001
111 001}}}
Write a function to return all possible paths from start (0,0) to destination (M-1,N-1). Allowed moves: right, down, and diagonal down. Value 1 indicates moves is possible, 0 indicates move not possible.
by via CareerCup RSS Feed
CareerCup: New Interview Question for
Given a BST write a function that looks for a value.
View »by via CareerCup RSS Feed
CareerCup: New Interview Question for
Implement a bowling game. First person took 40 mins to make sure I understood the scoring of bowling. Got stuck on coding an open-frame/strike/open-frame and time ran out with the second interviewer.
class Frame
def initialize
@rolls=[]
end
def roll(pins_down)
end
def score
end
end
class Game
attr_reader :frames
def initialize
@frames=[]
end
def score
end
end
by via CareerCup RSS Feed
CareerCup: New Interview Question for
A car rental company which rents car by per hour basis
wants to know the time period for maximum number cars that are rented. ie you are given the list of rental start time and return times of all rented cars in the day for all cars in a day find the maximum time period in which cars are on the road.
by via CareerCup RSS Feed
CareerCup: New Interview Question for
Write a function to print unique rows of a matrix.
I am thinking of a 0(n) solution for this (if possible).
I am storing the rows of the matrix in a set of vectors and then printing those rows. Please tell me how to do this and the correct time complexity for that. I am not very good with STL.
by via CareerCup RSS Feed