prashant.tah
BAN USER- 0of 0 votes
AnswersRound 3 - puzzle-there are 8 coins out of which 1 coin is faulty.The faulty coin has a lesser weight than the rest of coins which all have the same weight.You have been given a weighing balance with a pulley.Find the faulty coin
- prashant.tah in India| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Puzzle - 0of 0 votes
AnswersRound 3 - Write a java program to print a matrix in spiral
- prashant.tah in India| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswersRound 2 - Write a java program to determine if a 10 digit number is magic number.A number is magic number if it has all digits between 1 to 6 occuring in it or if it has any number between 0 to 9 occuring thrice or if it contains three consecutilvely increasing or decreasing digits differing by 1 example 345 or 543
- prashant.tah in India| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswersRound 1-question 1 - given an array of stock prices for n days.Write an algorithm to maximize the profit of a customer such that he can buy and sell only once.
- prashant.tah in India
-Question 2
Prove that complexity for searching in arraylist is o(n)
and adding is o(1)| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswerRound 2- puzzle given 4 pair of socks of different colors(Red,green,blue and yellow)
- prashant.tah in India
Arrange the socks in such a way such that there are exacly 4 socks between the yellow socks,3 between the red ones and 2 between the green| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer - 0of 0 votes
AnswersRound 1-Question 1
- prashant.tah in India
1)Given an array of stock prices for 7 continuous days.Write an algorithm to maximize the profit for a customer who buys stock on any day and sells it later.Buying and selling can happen only once and selling should happen on any day after buying| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswersGenarate and validate a magic matrix.A magic matrix is one in which the sum of every row,column,and every diagonal is same.One such matrix will be when every element in the matrix is same.generate and validate a magic matrix where every element is not the same
- prashant.tah in India| Report Duplicate | Flag | PURGE
Oracle Software Developer - 4of 4 votes
AnswersWrite algorithm for java grep command for word matching in the following context.Given a file containing n words.Given a word w and a number k.Find k words in the file occuring before occurence of w.Assume that the average word size is m in the file
- prashant.tah in India
eg.
aaa
bbb
ccc
booking
alpha
beta
gamma
for k=3 and w = booking
the output should be [aaa,bbb,ccc,booking]
similarly for k =2 and w = beta
output should be [booking,alpha,beta]
Assume that the file size can grow very large
and try to get solution with space complexity lesser than O(n)
I suggessted solution for iterating through file until the word w is found and maintaiining a queue of size K
The time complexity of my solution was O(nm)
and space complexity was O(k) .Any answers to improve the time and space complexity
Apparently they were looking for a better implementation of grep| Report Duplicate | Flag | PURGE
Booking.com Software Developer Algorithm
In the worst case we can assume that each word in the file is of length m and the pattern is also of length m and the mismatch occurs in the last character of each word so the O(n*m)
Also can you please explain the n/m thing that you wrote..i dint get it
@makarand
time complxity be O(n*m) as for each iteration there will be m comparisons to check whether the iterated word is matching with the given word w?Is this the right direction of thinking?
Hi Chris,
Wouldnt the time complxity be O(n*m) as for each iteration there will be m comparisons to check whether the iterated word is matching with the given word w?
Also can you please explain prepocessing thing in a little detail or give me a reference where i can read this up? can this help in bringing down space/time complexity?
@Steephen...I just bwanted to ask why you have used an arraylist for implementing the queue?Shouldnt we use a linkedlist instead ?As in case of linkedlist we only need to change the pointers but in arraylist each item will have to be shifted by one position ?
- prashant.tah September 14, 2017