Developer Program Engineer Interview Questions
- 0of 0 votes
AnswersAlgorithm to check whether given sequence is arithmetic progression or geometric progression
- 07.mayuresh August 26, 2014 in India| Report Duplicate | Flag | PURGE
Pubamatic Developer Program Engineer Algorithm - 0of 0 votes
AnswerAlgorithm to check whether given series is arithmetic progression or geometric progression
- 07.mayuresh August 26, 2014 in India| Report Duplicate | Flag | PURGE
Pubmatic Developer Program Engineer Algorithm - -3of 3 votes
AnswersI have two number A = 100 and B = 145;
- kienkun1990 August 10, 2014 in VN
I want to find all number that have digit of number is increase
Thanks| Report Duplicate | Flag | PURGE
Samsung Developer Program Engineer Algorithm - 0of 0 votes
AnswersGiven an array of strings as input, return an array of all strings that have repeated chars that appear together. For e.g. in "hello" l and in "summer" s is a repeated char that appears together. However in "robot" o is not a repeated char as it does not appear together.
- ruhi July 24, 2014 in United States
repeatChars({"hello","robot","summer","elephant"}) = {"hello","summer"}| Report Duplicate | Flag | PURGE
Amdocs Developer Program Engineer - -4of 6 votes
AnswersYou have an array of integers(size N), such that each integer is present an odd number of time, except 3 of them(which are present even number of times). Find the three numbers.
- gdg June 21, 2014 in United States for Bing
Only XOR based solution was permitted.
Time Complexity: O(N)
Space Complexity: O(1)
Sample Input:
{1,6,4,1,4,5,8,8,4,6,8,8,9,7,9,5,9}
Sample Output:
1 6 8| Report Duplicate | Flag | PURGE
Google Developer Program Engineer Arrays - 0of 0 votes
AnswersGiven a number, you have to replace digits of the number with a given character 'a' and print all such possible strings(replacing only 1 digit or more at a time). The constraint is that no 2 consecutive digits should be replaced.
- amish.cusat June 14, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer - -1of 1 vote
Answerswhat will output of this
- Kavita June 12, 2014 in India#include <iostream> #include<algorithm> using namespace std; class Sum { private: int s; public: Sum(int x):s(x) { } int getSum() { return s; } void operator()(int p) { s = s + p; } }; int main() { cout << "Hello World" << endl; int arr[] = {1,2,3,4,5,6,7,8}; Sum obj = for_each(arr,arr+7,Sum(1000)); cout<<obj.getSum()<<endl; return 0; }
| Report Duplicate | Flag | PURGE
Developer Program Engineer - 0of 0 votes
AnswersWrite a method that takes a given string and replaces all occurrences of one string with another string, returning the number of replaces made. For instance given the string “Microsoft” if you were to replace all occurrences of “ic” with “MSFT” the result would be “MMSFTrosoft” with a return value of 1. As part of a final solution please provide unit tests done as well as any test cases ran. Please note that you may not use String.Replace or string::replace depending upon the language you use; you must write this functionality yourself.
- warunthambi June 10, 2014 in India for teamviewer| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer Coding - 0of 0 votes
AnswersImplement a class that does string manipulation by overloading the following operators: <<, >>, = and ==. For example consider the following code:
- warunthambi June 10, 2014 in India for teamviewer
StrShift example;
example = “Microsoft”;
printf(“\”example << 2\” results in %s\n“, example << 2);
In the above code the output would be “ftMicroso” which shows the last two characters of the string “Microsoft” rotated to the left of the string. Please note that state is maintained so two calls of example << 1 would give the same end result as calling example << 2 once. Consideration will be given to correctness, design, code readability as well as any unit testing. As part of a final solution please submit test cases you used to verify correctness in addition to any unit tests done.| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer Coding - 0of 0 votes
AnswersWrite a class that represents a minimal heap. The heap class should at a minimum support the following methods:
- warunthambi June 10, 2014 in India for teamviewer
- AllocTinyHeap() which should initialize the heap with a given amount of bytes
- DeleteTinyHeap() which frees all memory associated with the heap
- TinyAlloc() which allocates a given number of bytes on the heap if there is room
- TinyFree() which frees a specific location on the heap
You may define whatever parameters are necessary for the above methods as well as write any additional methods. Overall consideration will be given to correctness, design, code readability as well as any unit testing done. As part of a final solution please submit test cases you used to verify correctness in addition to any unit tests done.| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer Coding - 0of 0 votes
AnswerI was asked to design a trading system, where there will be no of buyers and sellers will transact. The system need to have low latency, the buyers will quote no of shares, company name, price they want to buy, the sellers will quote the price they want to sell for given company, and no of shares. The system has to match the buyers and sellers and transact. This is more of design question.
- softwaregeek June 09, 2014 in India
I was thinking in terms of a hashmap kind a structure where the key will hash to the given company, and then there will be buckets for no of shares for buyers, with different buckets for prices, the idea is to look up in memory sellers, if a match is found then make the transaction. If the in memory data exceeds a limit implement a caching, and push the older data to the persistent store. The guy was'nt convinced this was a good design. Can someone suggest how is real time trading systems implemented, do they go for low latency queues.| Report Duplicate | Flag | PURGE
InMobi Developer Program Engineer Computer Architecture & Low Level - 7of 7 votes
AnswersGiven a string (for example: "a?bc?def?g"), write a program to generate all the possible strings by replacing ? with 0 and 1.
- pennepalli May 30, 2014 in United States
Example:
Input : a?b?c?
Output: a0b0c0, a0b0c1, a0b1c0, a0b1c1, a1b0c0, a1b0c1, a1b1c0, a1b1c1.| Report Duplicate | Flag | PURGE
Google Developer Program Engineer Algorithm C# C++ Java - -2of 2 votes
AnswersTable 1: Parents -> (int id, int age)
- pennepalli May 30, 2014 in United States
Table 2: Children -> (int id, int age, int parent_id)
Get the parent id, his/her oldest and youngest children ids.| Report Duplicate | Flag | PURGE
Google Developer Program Engineer SQL - -1of 3 votes
AnswersTable 1: Parents -> (int id, int age, int Child_id)
- pennepalli May 30, 2014 in United States
Table 2: Children -> (int id, int age, int parent_id)
Get the parent id, his/her oldest and youngest children ids.| Report Duplicate | Flag | PURGE
Google Developer Program Engineer SQL - 0of 0 votes
AnswersI was asked this during a recent interview.
- kloblivioner April 18, 2014 in United States
Lucky number – a number is a lucky number if it comprises of combination of 4′s and 7′s.
For example , if 32 is the input number, the next nearest lucky number would be 44.
Similarly ,
43 -> 44
45 -> 47
1004 -> 4444
Input number can be of any digits.
Design an algorithm that will take any random number and return its next lucky number| Report Duplicate | Flag | PURGE
ADP Developer Program Engineer Algorithm - 0of 0 votes
AnswersIn Byteland they have a very strange monetary system. Each Bytelandian gold coin has an integer number written on it. A coin n can be exchanged in a bank into three coins: n/2, n/3 and n/4. But these numbers are all rounded down (the banks have to make a profit).
You can also sell Bytelandian coins for American dollars. The exchange rate is 1:1. But you can not buy Bytelandian coins. You have one gold coin. What is the maximum amount of American dollars you can get for it?
Input The input will contain several test cases (not more than 10). Each testcase is a single line with a number n, 0 <= n <= 1 000 000 000. It is the number written on your coin.
Output For each test case output a single line, containing the maximum amount of American dollars you can make.
Explanation You can change 12 into 6, 4 and 3, and then change these into $6+$4+$3 = $13. If you try changing the coin 2 into 3 smaller coins, you will get 1, 0 and 0, and later you can get no more than $1 out of them. It is better just to change the 2 coin directly into $2. Pls suggest a better approach.
Here's My code:
- yash April 18, 2014 in Indiaimport java.util.*; class Bytelandain { Vector v= null; Scanner sc = null; public Bytelandain() { v = new Vector(); sc = new Scanner(System.in); int i=1; String s =null; while (i<=10 ) { s = sc.nextLine(); if( s.equals("") ) break; int temp = Integer.parseInt(s); v.add(temp); i++; } for(i=0;i<v.size();i++) { showProfit((Integer)v.get(i)); } } public static void main(String args[]) { Bytelandain by = new Bytelandain(); } public void showProfit(int num) { System.out.println(computeValue(num)); } public int computeValue(int num) { int value = 0; if(num<=2) { return num; } value = getProfit(num,value); if(num >= value) { return num; } return value; } public int getProfit(int num,int value) { int sum; sum = value; sum = sum+ computeValue(num/2)+computeValue(num/3)+computeValue(num/4); return sum; } }
| Report Duplicate | Flag | PURGE
Persistent Systems Developer Program Engineer - 0of 0 votes
AnswersGiven a tree T of nodes such that each node contains a number. A set of nodes is a Largest independent set of T (i.e. there can be no common edge between the elements). Use dynamic programming to solve this.
- nesh2391 April 12, 2014 in United States
No recursion only loops and table must be used, you can recurse through the tree to fill some initial values in the table| Report Duplicate | Flag | PURGE
Adobe Developer Program Engineer Algorithm - 0of 0 votes
AnswersThere is a party going on. A favorite group has to be found out. Suppose there are five people A, B, C, D and E.
- ThanksAll April 04, 2014 in India
A, B and C knows each other. D and E knows A, B and C. So ABC is the favorite group as all of them know each othe and
evry other in the party knows them. Question was How to find this group and which datastructure/algo will be suitable?| Report Duplicate | Flag | PURGE
Flipkart Developer Program Engineer Algorithm - 1of 1 vote
AnswersGiven a string, find the largest repetitive sequence. Algo + Code
- sameer.careercup April 02, 2014 in India
Ex: abcdefbcd – bcd, banana – ana| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer Algorithm - 0of 0 votes
AnswersGiven a paragraph of text, write a program to find the first shortest sub-segment that contains each of the given k words at least once. A segment is said to be shorter than other if it contains less number of words
- sameer.careercup April 01, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer Algorithm - 1of 1 vote
Answersdivide a given array into two subarray (not necessary to be continuous) such that difference between sum of both array is minimum. Required was recursive code for this. tried solving using idea from min coin change problem was couldn't.
- sameer.careercup April 01, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer Algorithm - -1of 3 votes
AnswersIF we remove next line character then program runs fine else it gives a seg fault
- KERNEL_HACKER March 09, 2014 in India#include <stdio.h> void main() { char *a[10] = {"hi", "hello", "how"}; int i = 0, j = 0; a[0] = "hey"; for (i = 0;i < 10; i++) printf("%s\n", a[i]); }
| Report Duplicate | Flag | PURGE
Developer Program Engineer C# - 2of 4 votes
AnswersImagine x is an operand and * is a binary operator. We say a string of x and * follows Reverse Polish notation if it is a postfix notation.
- mahdi.oraei March 03, 2014 in United States
For example strings xx*, x, and xx*xx** follow Reverse Polish notation.
Given a string of x and *, how many insert, delete, and replace operations are needed to make the string follow the RPN.
For example, xx* need 0 operation to follow RPN since it already follows RPN.
x*x needs two operations to become xx* which follows RPN.
*xx* needs one operation to become xx* which follows RPN.
Your algorithm should work for a string of size up to 100.| Report Duplicate | Flag | PURGE
Facebook Developer Program Engineer - -1of 1 vote
AnswerIf the stored Proc suddenly start running slow ,what will you do??
- hrishi.wankhade February 26, 2014 in India for DOD| Report Duplicate | Flag | PURGE
Cognzant Technology Solutions Developer Program Engineer - 1of 1 vote
Answers1>Draw structure of cluster and non cluster index.
- hrishi.wankhade February 26, 2014 in India for DOD
2>Fregrementation ,types,how to unfregement
3>When will you go for rebuild and reorginise index.
4>coloumn in (1,2,3,'null',null) what will be the result.| Report Duplicate | Flag | PURGE
Cognzant Technology Solutions Developer Program Engineer - 0of 0 votes
AnswersGiven a string, print the character which appears the maximum number of times in the string.
- kumar.prince6 February 20, 2014 in United States
The string will contain only ascii characters. If there is a tie in the maximum number
of times a character appears in the string, print the character which appears first in the string.
Notes:
1. The length of the string will be between 1 and 10000, inclusive.
2. Make sure you don't print anything other than a single character in the function. Otherwise, your solution will be marked wrong.
3. You only need to complete the function printMaximumOccurringCharacter.
Sample Input #00
helloworld
Sample Output #00
l
Sample Input #01
aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
Sample Output #01
a
Sample Input #02
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
Sample Output #02
a
4.| Report Duplicate | Flag | PURGE
Expedia Developer Program Engineer Algorithm - 0of 0 votes
Answers.There is an infinite integer grid at which N people have their houses on. They decide to unite at
- kumar.prince6 February 20, 2014 in United States
a common meeting place, which is someone's house.
From any given cell, all 8 adjacent cells are reachable in 1 unit of time.
eg: (x,y) can be reached from (x-1,y+1) in a single unit of time.
Find a common meeting place which minimises the sum of the travel times of all the persons.
Input Format:
N
The following N lines will contain two integers saying the x & y coordinate of the i-th person.
Output Format:
M M = min sum of all travel times;
Constraints:
N <= 10^5
The absolute value of each co-ordinate in the input will be atmost 109
HINT: Please use long long 64-bit integers;
Input #00:
4
0 1
2 5
3 1
4 0
Output #00:
8
Explanation: Sums of travel times of the houses are 11, 13, 8 and 10. 8 is the minimum.
Input #01:
6
12 -14
-3 3
-14 7
-14 -3
2 -12
-1 -6
Output #01:| Report Duplicate | Flag | PURGE
Expedia Developer Program Engineer Algorithm - 0of 0 votes
AnswersConsider an array which may contains the alphabets from A to Z.
- pippirisaikumar.9 January 11, 2014 in India
suppose consider the below examples
A[9] = {A,C,D,G,D,E,A,C,A}; then the output should be in the format of A=3;C=2;D=2;E=1;G=1
A[9] = {A,B,D,C,D,B,A,B,A}; then the output should be in the format of A=3;B=3;C=1;D=2
write the logic in C. the values in array may vary. the output should count the alphabets in the array| Report Duplicate | Flag | PURGE
Infosys Developer Program Engineer - 2of 2 votes
AnswersGiven a list/array of names(String) sort them such that each name is followed by a name which starts with the last character of the previous name.
- anurag.11feb January 07, 2014 in Netherlands
# input
[
Luis
Hector
Selena
Emmanuel
Amish
]
# output:
[
Emmanuel
Luis
Selena
Amish
Hector
]| Report Duplicate | Flag | PURGE
Booking.com Developer Program Engineer Algorithm