Forum Posts
- 2 Answers How long after Amazon interview?
I appeared for a personal interview at Amazon, after clearing phone interview. It's been 5 business days (if I don't count the interview day) and I haven't heard anything back. There was also not response from an immediate follow-up. How long does Amazon take to reveal personal interview results?
- glensmooth August 10, 2014| Flag | PURGE - 2 Answers Unable to post SumoLogic StartUp company interview questions, if anyone can post on my behalf will be thank ful
Unable to post SumoLogic StartUp company interview questions, if anyone can post on my behalf will be thank ful
- rockykumar1970 August 05, 2014
Question 1 :
Kindly find the question below:
Design a data structure which has following operations:
1. void add(e)
2. void delete(e)
3. boolean contains(e)
4. e getRandom()
5. e getMostRecent()
All operations should be preferably O(1)
Answer :
public class ValidateData
{
private HashMap<Object, Integer> hashMap = new HashMap<>();
private ArrayList<Object> list;
public ValidateData()
{
hashMap = new HashMap<>();
list = new ArrayList<>();
}
public void insert(Object object)
{
int index = list.size();
hashMap.put(object, index);
list.add(object);
}
public boolean contains(Object object)
{
return hashMap.containsKey(object);
}
public void delete(Object object)
{
if (hashMap.containsKey(object))
{
int index = hashMap.get(object);
int end = list.size() - 1;
Object o = list.get(end);
list.set(index, o);
list.remove(end);
hashMap.put(o, index);
hashMap.remove(object);
}
}
public Object getRandom()
{
Random rand = new Random();
int index = rand.nextInt(list.size());
System.out.println(list.get(index));
return list.get(index);
}| Flag | PURGE - 1 Answer brain teaser
you have a random sequence of number from 1-10, 2 players and u being the first player ! Each player can only choose a number close to the one that is already chosen or the last number . The winner is the one that has a larger total ( in this case above 28 since the total of the numbers is 55 ) How can u ensure u always win??
- jumanamadi5 August 04, 2014
example
4 6 3 7 10 2 9 8 5 1 - You have this starting sequence
I am player one and I choose 4
player 2 can choose either 6 or 1
Assuming he choose 6 I can either choose 3 or 1 and so on...
I chose 3 and player 2 chose 7
I chose 10 and player 2 chose 2
I chose 9 and player 2 chose 8
I chose 5 and player 2 chose 1
my total :4+3+10+9+5= 31
Player 2 : 6+7+2+8+1= 24
therefore I won.
How can we generate a winning sequence every time even though the numbers r changing?| Flag | PURGE - 0 Answers Amazon question
Your business team wants to understand customer behavior for page clicks. The customer's click history with time stamp is stored in an unsorted log file (sample record below). The business team would like to understand what % of customers visited 3 Browse pages with at most 2 other page-hits all together in between the Browse page hits within a 15 minute window. Write an efficient program to find the % of customers meeting the criteria. Please clearly state the assumptions you are making as part of your implementation. Please analyze the runtime of your program.
- vamsikrishna198616 August 03, 2014
Sample entry in log file
Customer001=Gateway:13456723453,Browse:13456723452,Detail:1345672342,Gateway:134567234123,Search:134567225123,Account:134567234123 … … …| Flag | PURGE - 0 Answers This code is working well locally, but fails sometimes when it is deployed. Why?
@WebService is a spring annotation
- shakesmove July 30, 2014
public class Calculator {
@WebService
public boolean isSumOdd(int sum1, int sum2) {
int result = 0;
result = sum1 + sum2;
if (result % 2 == 1) {
return true;
}
return false;
}
}
// The answer seems to be related that this singleton is not thread-safe but why I have to take care about syncronization ? Every thread doesn't pass his variable to this singleton to get the result? Doesn't it have in his switch context the state of the sum variables?
Does the thread share also the variable inside the scope of the method in a singleton so this could lead to problem? I was thinking that the variable are passed by value and copied and after a context switch the other thread has the possibility to restore his state but I believe that I am wrong.....| Flag | PURGE - 3 Answers Need urgent help
Given an array in which each element differs from its previous element by +1/-1 find the First occurence (position) of a given (input) element without using Linear search eg :- Let array = 4,5,6,5,6,7,8,9,10,9,8,9,10,11... input - 10 output - 8 ( First occurence of 10 is at 8th position)
- sheetalspatel15 July 30, 2014| Flag | PURGE - 2 Answers Sharpening algorithms/problem solving skills
I recently got a rejection from Amazon and Google.
- panktim20 July 27, 2014
I am comfortable with algorithms and DS but also feel there is scope for sharpening my problem solving skills.
However, I had practiced a number of coding questions for my previous interviews so
preparing or studying again for other interviews feels like a repetition.
Any suggestions on how I can continue to improve my algorithm and problem solving skills will be helpful.| Flag | PURGE - 0 Answers Future in PLM domain for a software Engineer
Hi Folks,
- gupta.abhishek.great July 27, 2014
a day before, I appeared for an interview process in a Mechanical automotive based software part of a company. It works on automotive PLM. I want to know if there are ample opportunity in PL M area for future growth or not.| Flag | PURGE - 0 Answers School Choice
Hi all, I'm currently reading cracking the code interview and am currently studying for the job market when I graduate next spring. I currently attend a not so well known state college but I have worked on many big projects and have a lot of work experience. Will I be faced with challenges because of my school choice? That is, will I be shunned away?
- jtgorney July 24, 2014| Flag | PURGE - 3 Answers Algorithms in interviews
Interviewers ask many algorithms questions in big MNCs. Do you think that these questions are good questions to ask in interviews ? Is it a good assumption that If a person who answers these questions will do the job? and does job involves inventing new alogorthms everyday
- talktomenow July 22, 2014
? I dont know why these types of questions are asked in interviews. If a person does not know about some algorthim, say Kadane's algorithm, then does interviewer expects canidates to invent it during interview. ? are not these algorithms were invented by many years of research? I am not able to understand the logic behind asking these types of question.| Flag | PURGE - 3 Answers Goldman Sachs Java Interview Singapore
Hi,
- nash6137 July 22, 2014
Anyone ever attended a technical interview for Java developer position in Goldman Sachs, Singapore. If so could you please share details about interview process like how many rounds it would be etc.? Would there be any test?| Flag | PURGE - 1 Answer print all validate parentheses - found mistake in the book
This question is from "Cracking the coding interview" (Fourth Edition) and I think that I found mistake in the answer.
let's take n=3 in the book example you get 4 sequences, but I think there is 5 sequences. ((())), ()(()), ()()(), (()()), (())()
also my solution is much more simple from that in the book
- mosh111 July 16, 2014public static ArrayList<String> GetAllNPairsOfParentheses(int n) { ArrayList<String> retArray; if (n==1) { retArray=new ArrayList<String>(); retArray.add("()"); return retArray; } retArray= GetAllNPairsOfParentheses(n-1); HashSet<String> hash=new HashSet<String>(); for (String currentPrantheses : retArray) { for (int i=0;i<currentPrantheses.length();i++) { String currentPranthesesBegin = currentPrantheses.substring(0,i); String currentPranthesesEnd = currentPrantheses.substring(i); String newPrantheses= currentPranthesesBegin+"()"+currentPranthesesEnd; if (!hash.contains(newPrantheses)) { hash.add(newPrantheses); } } } retArray=new ArrayList<String>(); for (String currentPrantheses : hash) { retArray.add(currentPrantheses); } return retArray; }
| Flag | PURGE - 4 Answers Finding all prime numbers within a given range
This is problem PRIME1 from SPOJ:
- shahsunny712 June 30, 2014
Input:
The input begins with the number t of test cases in a single line (t<=10). In each of the next t lines there are two numbers m and n (1 <= m <= n <= 1000000000, n-m<=100000) separated by a space.
Output:
For every test case print all prime numbers p such that m <= p <= n, one number per line, test cases separated by an empty line.
To solve this, I applied a variation of the sieve of eratosthenes to calculate all primes from 2 to the maximum input number. Then iterate over that list and print out the numbers for each test case.
However, this gives TLE when the maximum input is 100000000(the allowed max). At several online forums, I read that to solve this, one needs to calculate primes only upto sqrt(100000000). I don't understand why this should work. Won't there be primes in the range say, 10000000 - 100000000 which are much greater than 100000000 ?| Flag | PURGE