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 »
Posted by Yev on July 15, 2015

by via CareerCup RSS Feed

CareerCup: New Interview Question for

How Qt achieves platform neutrality

View »
Posted by jkl on July 15, 2015

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 »
Posted by DVD on July 15, 2015

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 »
Posted by coredo on July 14, 2015

by via CareerCup RSS Feed

CareerCup: New Interview Question for

Posted by anon on July 14, 2015

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 »
Posted by tested.candidate on July 14, 2015

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 »
Posted by tested.candidate on July 14, 2015

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 »
Posted by tested.candidate on July 14, 2015

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 »
Posted by tested.candidate on July 14, 2015

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 »
Posted by tested.candidate on July 14, 2015

by via CareerCup RSS Feed

CareerCup: New Interview Question for

Check if two given words are anagrams of each other.

View »
Posted by tested.candidate on July 14, 2015

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 »
Posted by tested.candidate on July 14, 2015

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 »
Posted by tested.candidate on July 14, 2015

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");
}
}

View »
Posted by Avinash on July 14, 2015

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 »
Posted by rv on July 14, 2015

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.

View »
Posted by rv on July 14, 2015

by via CareerCup RSS Feed

CareerCup: New Interview Question for

Given a BST write a function that looks for a value.

View »
Posted by rv on July 14, 2015

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

View »
Posted by Yev on July 14, 2015

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.

View »
Posted by Goodprodd on July 14, 2015

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.

View »
Posted by dynmoz007 on July 13, 2015

by via CareerCup RSS Feed