hprem991
BAN USER
- 0of 2 votes
AnswersI am surprised by this GS question.I thought this is one of the classic number theory partition problem which is so hard that the best algorithm is approximation one.
- hprem991 in United States
Given value, find all possible combination of ways which equals to that sum.| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer Coding - 1of 1 vote
AnswersGoogle Fucked up question.
- hprem991 in United States
Given a random list of appointments (Start Date , End Date). Find all the appointments that are colliding.
This pretty easy looking question screwed me up today.There are tons of edge cases, I couldn't complete em all and 45 minutes pass like 15 minutes while explaining and coding same time.| Report Duplicate | Flag | PURGE
Google Software Engineer Coding - 0of 0 votes
AnswersGot Sp00ked by MS simple question..
- hprem991 in United States
Eight Ball problem, find Minimum steps to determine the heaviest one.
Anyone know the answer is 2 in case of 8 balls.. Question is code getHeavy when number of balls are not determined.
int getHeavy(List<Integer> balls){
// Your solution
}| Report Duplicate | Flag | PURGE
Microsoft SDET - 1of 1 vote
AnswersWAP to Convert Hex String to Equivalent decimal Integer.
- hprem991 in United States| Report Duplicate | Flag | PURGE
SDE-2 - 0of 0 votes
AnswersDesign Distributed Web Crawler.
- hprem991 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersImplement bool isPalindrome(SingleLinkList *node) in constant Space.
- hprem991 in United States for Chennei
Sorry for incomplete post earlier..| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C++ - 0of 0 votes
AnswersImplement bool regex() Function.
- hprem991 in India for Chennei| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C++ Coding - 1of 1 vote
AnswersImplement bool isBST(Tree * root)
- hprem991 in India for Chennei| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C++ Coding - -3of 3 votes
AnswersDesign and code static simulator for all gates .i.e. AND / OR / XOR etc.
- hprem991 in United States
Where the simulator has to work properly not only for the binary digit but also for the algebraic inputs (i.e doubles as a input type.)| Report Duplicate | Flag | PURGE
Senior Software Development Engineer Algorithm C++ - 0of 0 votes
AnswersHow do we design a class.forName("CLASS") , kind of function?
- hprem991 in United States
Where the function will accept a string (as a Class Name) as a parameter and accordingly convert it into the subsequent CLASS object.| Report Duplicate | Flag | PURGE
Solutions Architect Algorithm C++ - -1of 1 vote
AnswersIs there any difference between the usage of void pointer and unsigned int ? if yes what the advantage of one over other?
- hprem991 in United States
Guys I havn't thought guys commenting here are idiots as well. so please read the detail explanation for it in my below comment. :)| Report Duplicate | Flag | PURGE
Software Architect C - 0of 0 votes
AnswersDesign LRU in C++
- hprem991 in India| Report Duplicate | Flag | PURGE
StartUp Software Architect Algorithm C++ - 0of 0 votes
AnswerDesign Garbage Collector in C++.
- hprem991 in India| Report Duplicate | Flag | PURGE
StartUp Software Architect Algorithm C++ - 0of 0 votes
AnswersDesign a Tic Tac Toe Game. Classes Segregation and Code Flow.
- hprem991 in India| Report Duplicate | Flag | PURGE
StartUp Amazon Software Architect Software Engineer / Developer Algorithm Android Application / UI Design Arrays Assembly Automata Behavioral Bit Manipulation Brain Teasers C C++ Object Oriented Design - 0of 0 votes
AnswersGiven a Big XML File. You have to design and implement the Data Structure which stored their keys and its value accordingly in C/C++ language.
- hprem991 in India for Protocol Devlopment
Write a Program to Store all the given XML content to your designed Data Structure and Retrive it . Basically SAX/DOM parser :)
Contraints :-
1> Data Structure should not be a flat file type.
2> Every Program code must be modular and each module should not exceed 15 lines of code.
3> No Usage of STL library functions.
4> Each Module should not have return type other than success and failure of operation.
5> Use Memory management at the most.
6> Design and problem approach crutial.
7> Minimal Space and Time Complexity for each code.
8> No Static variable usage and all memory allocation should be dynamic.
9> There are occasion like a parent has more than one child you have to take care of such cases.
10> Handle all possible error condition.| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer Application / UI Design - 0of 0 votes
AnswersWrite a MergeSort for Two Different Sorted Link List.. Emphasis on TO and SO with all Error Conditions...
- hprem991 in India for SEL| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer C - 0of 0 votes
AnswerHow do you Design Access Specifier in C.
- hprem991 in India| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer Application / UI Design - 0of 0 votes
AnswersGiven pointer
- hprem991 in India
char *p = <body> <tagname1>Tagvalue1</tagname1>
<tagname2>Tagvalue2</tagname2>
<tagname3>Tagvalue3</tagname3>
..
..
..
<tagnamen>Tagvaluen</tagnamen>
</body>
Write a Program to replace a Tagvalue from existing Value to User Provided New Value..
example : - Your Function Func(TagName,New tagvalue) should replace the existing tagvalue of the Tagname to NewTagName..
Given Constraints :-
1> Function should be granular enough.
2> Its actually a design question so approach is important.
3> Take Care of Error Condition . Like TagName not found etc.
4> Also make sure the conditions like if the Given Tagvalue is not of Same Length that proper handling etc.| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer Application / UI Design - 0of 0 votes
AnswersDesign the XML Parser.
- hprem991 in India| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer Application / UI Design
0 Answers Is Amazon Joking Around?
Amazon is known for its tough tech screening rounds but even if you nail those technical question with best possible solution, are you getting screwed??
- hprem991 August 04, 2017
Before this experience, I would have said NO but now it is looking different..
I was being picked up by their recruiter and asked to present myself for phone screening as they liked my experience (thats what they said ).
Now, I wouldnt mind.. being the fact that I am doing great in what I am doing.. its just a 1 hour call.
Well, call lasted for like 55 mins.. Was asked 2 algorithmic questions with code and follow ups and some pretty team / experience related question..
I nailed the tech rounds so much that the interviewer said, I got questions done with most optimal solutions and of course before time.
So, if they liked my experiences ( thats what they said they called me at first place).. Did they rejected me for same experience or Amazon interview has become a joking ground now?
Any thoughts??| Flag | PURGE 1 Answer Subscription Mail Cancellation .
Hi ,
- hprem991 May 06, 2013
I am not sure if this is with me or with everyone else as I am getting a lot of mails into my private and registered mail id regarding the question / discussion after every user comments from here.
I may have put comment of my own on the same question sometimes back and may becoz of that I am getting the same but the question here is the is no way to unsubscribe those subscriptions.
Although , C C does have the checkbox at the bottom of the question under discussion but I am not sure why it is "Checked" by default and always gets redirected to mail account.
Gayle, Could you please provide the single point of subscription / UnSubscription button which will help user to regulate this mail forwarding option.
Thanks
Prem| Flag | PURGE 2 Answers Technical Issue With C C Server
There is an issue ( I reported as Bug Already) .When User were trying to put Comment or Reply on any question causes Server Error ("The server encountered an error and could not complete your request.") message flashes on Screen but the note is already being processed by the server (Sometimes).
- hprem991 April 24, 2013
This is causing some user to re-submit their words making number of duplicate comments or in some cases missing their comments.| Flag | PURGE
View Count could be a major factor. Question is what is the condition or factor to cause a post / product a trend? is it people view, click, people response? Based of that you can use priority queue at least for normal interview based question but in real time, this could blow up heavily
- hprem991 July 16, 2018@Daniel, I had O(nlog) solution and I was almost there.. Everytime I got something, he was pointing out another edge cases to the point that he himself was confused at times..
I haven't read you full solution but I can tell you one thing that during conversation, when I was stuck at one use case, he asked me burte force solution, which I gave instantaneous and it is O(n2) which he agreed to solve the problem but we both were trying to improvise.
So your above solution may not be challenging.
TreeNode getMax(TreeNode root, TreeNode currentMax, enum attribValue){
if(root == null)
return currentMax;
if ((root->left.val == attribValue) && (root->left.val == attribValue)) {
getMax(root->left, currentMax, attribValue);
getMax(root->right, currentMax, attribValue);
} else {
getMax(root->left, root->left, attribValue);
getMax(root->right, root->right,, attribValue);
}
}
My Algo is
boolean find(String s){
Map<String, Integer> map = new HashMap<String, Integer>();
int maxRepeat = 0, noofChar = 0;
for(char c: s.toCharArray()){
if(map.containsKey(c)){
int i = map.getVal(c);
map.put(c, ++i);
} else {
map.put(c, 1);
}
}
for(Map.EntrySet<String, Integer> entry: map.entrySet()){
if(maxRepeat < entry.getValue()) maxRepeat = entry.getValue();
noofChar++;
}
return ((noofChar / maxRepeat) > 1) ? true : false);
}
This requires consideration amount of memcache experience to properly answer. Few of my options are
1> Secondary Indexing, Where we let cache to know its existence and once hit, can redirect to where it is located.
2> Serialization, storing raw bit value, and distributing to multiple cache location till it finds end of object.
Both of the above process are generally used depending upon the requirements.
I have seen a tons of response for this simple question. I dont think this question is intended to provide sorted square of integer inputs. Interviewer wanna check how much candidate knows about Integer implementation.
As we square up high value integer, it wont fit in another integer so unless you come up with a custom class which able to do so, all above responses are wrong. Specially when a candidate is interviewing top companies
Use
Map<Date, List<Integer>> map = new HashMap<Date, List<Integer>>
Insert :
List<Integer> songsId = map.get(currentDate);
songsId.add(newSongId);
map.add(currentDate, songsId );
retrieve:
for(Map::EntrySet<Date, List<Integer>> entry : map){
if(DateWithinWeek( entry.getKey())){
for(Integer songsId : entry.getVal){
// output the result
}
}
}
@ChrisK,
I got what you are saying, you are talking about for every update you have to call up the nodes to update it content.
what if we always point a node.value to the value of a global variable? I'll try to give you a code later after work, but I think I can make it work.
@ChrisK
Nope, I dont think you got it.
Think you have a global / static variable holding a sum of all the node.value visited so far. Now each node has a function called updateOnWrite(); which updates it node.value if this global value changes it content. That what copy on write means, someone over written a value and you have to update you content.
Each node updates it value independently.
@ChrisK,
Nope, I dont think you got what I suppose to mean.
Think you are updating a static / global variable every time you visit a node and each Node has to update its value if the value of this global / static variable is changed, that what copy on write me. Someone has rewritten the data and your data is dirty forcing a node to update its content.
Each node update its content independently.
@ChrisK
There are multiple ways to implement it.
Design Patterns like observers can be used as well as you can set a reference of each node.data value to some common address and update that common memory location updating everynode while you calculate the total sum. Last value updated will be the value of all node.
Whoever that negative Voter is, should be ashamed of yourself. I already have mentioned this question is to gather experience not to showcase your technical question, coz even if you got em aced, it doesn't look like folks are playing fair game..
And you are one of em it seems
Hey Thanks for letting me know that I am not the only one.
I was surprised and wrote back to that HR if its true. I think now Amazon has reached to the point where they got the monopoly and office politics and bureaucracy has become their part of culture...
The only explanation I can think of it is someone got in through internal reference and they conducted / wasted my time just for the sake of showing up numbers.
Load balancing is what interviewer is looking for but its ambiguous when he says "Slow".It can be any from a broad spectrum.
If its getting slow relative to its earlier performance than it varies from network speed to amount of space / resources available at server end.
In terms of codes, the best you can do is limiting the use of thread by threadpooling. meaning, you can spawn specific number of threads at a time so that it wont hog the system doing nothing but scheduling.
Very interesting question. Interviewer is definitely looking for brainstorming and may be he will jump in it as well.. Love such rounds..
There is no definite answer to this question, but my approach is as follows
class BlockChain{
HashValue;
Deltas;
TimeStamp;
}
class Auth{
string userName;
string repository;
// Other params
}
Now git is distributed system but its not fully distributed. If git were to be fully distributed, things will blow pretty fast and gonna be even complex.. So
class Server{
Auth m_Auth;
List<BlockChain> m_blockChains;
//other parameters
}
class Client {
Auth m_auth;
List<BlockChain> m_blocks;
BlockChain m_currentSession;
//Rest of the params
}
Now the methods for each classes are very much depends on how / what functions git supports
How the hell it is a decorator ? Explain.. coz this is a classic example of Command design pattern.
Reason is it is command coz you can configure what slots goes to what denomination of currency and how many denomination can be arranged when we set the ATM machine object.
This also, employs State design pattern, coz every time, you do the operation, you will change the state of machine.
Can share the code if required but will be messy in such question coz its purely a discussion based.
I dont know how you people gets so lucky man ?
When I got a call from them, my question is so vague that I waste my 40 minute to get hold of it and still wasn't sure if I was doing it correct losing all the time.
So, answering this part as follows.
int generateRandon(int size){
int dp[][] = int [size +1 ][size +1];
for(int x = 0; x < size; x++){
for(int y =0; y < size; y++){
int rand = Math.random(LOWER, HIGHER); // rewrite this custom random
if(x>0 || y > 0){
int valX = dp[x-1][y];
int valY = dp[x][y-1];
if((rand == valX) || (rand == valY)){
y--; continue;
} else {
dp[x][y] = rand;
}
}
}
}
return dp;
}
This is a design pattern question.
As far as I can see multiple patterns can be use for designing. One of my best bet is Observer design pattern.
Every day a client application (each uber picks up a client), it stores its users info in its local system or update to secondary system.
Your Dash acts as an observers and collects the subject info and churn out the data.
Now, to handle this kinda question depends upon you comfort in pattern understanding as question like this may takes a lot of time to address in short interviews and interviewer is basically looking for your understanding then correct answer. (There is no wrong answer to such questions as far as you can argue your pattern is correct).
Implementation should be straight forward once you know the pattern.
Really a google question ?
Plain O(n).
Collect all char in a hash.
For each char in hash
if(hash.containsKey(char) > 1){
put that char in new string, i & strlen(str) - i position
update hash.add(char , (hash.containsKey(char) - 2))
} else {
int val = hash.get(char);
hash.add(char, hash.containsKey(char) - 1);
if(!hash.isempty()){
Error:-> Cannot be formed
}
}
Any memory layout explanation fits the output but understanding it seems complex. So here it is..
When you create derived object, base class object is created before derived class object. When you stack them one over other and try to access it with variable base address, the complier has no clue which one is variable "a" or "b".
So what it does is with respect to the current base address, it tries to access the member. So in your case.
(obj + 0) = Address of arrd as base address of object
(obj + 1) = Address of arrd + 4 byte (as your base class has 1 integer variable). Base address of object
Interestingly here, when you do (obj + 1)->getA(), complier access the first integer wrt its current base which unfortunately is the variable "b" of derived class for you.So it this output.
Ambitious question,
Not able to find the relationship between the question you posted and the example you cited, how is 7->1 not in the list. Are you talking about user visiting pages relationship or the order in which the user is visiting the pages relationship question on the floor?
One possible solution is
#1
1> Find all the palindromes in the stream.
2> For each palindrome in the list
if(hash.containsKey(palidrome)){
hash.add(palindrome, hash.getValue(palindrome) + 1);
} else {
hash.add(Key, 1);
}
3> Find the max count in the hash and print that key.
#2,
Prefix Array calculation in KMP algorithm could be used
As each prefix array is the suffix of the current string, the value will give the solution in minimum time and space complexity
You know what this can be an excellent question. I am not sure even interviewer thought to be that one. This actually is a palindrome question. Here is how.
The question is not to balance a parenthesis, which an be debatable coz any combination can give you balance expression.
So, how do you resolve this problem, is parse all string except braces and replace with common character. Ex. (a(b(c)de will become (x(x(x)xx.
Now, what it takes to convert this expression into palindrome is the question. I am sure may can now answer without further hints .
RepGayle L McDowell, CEO at CareerCup
Gayle Laakmann McDowell is the founder / CEO of CareerCup, which provides programming interview prep for candidates interviewing with Microsoft, Google ...
Rep
Rep
RepI am Jenae Wilder and I work as a content writer, A writer at day, and a reader at night ...
RepDiscover the best online vaporizer store to buy quality vaping accessories at affordable price. Visit NY Vape Shop, specialized in ...
RepLooking for the best day care center Charlotte? Pal-A-Roo’s Child Development Center is a family owned child care facility ...
Repour goal is to help individuals companies and organizations of all kinds to communicate with their clients customer and employees ...
RepAmber Van is the top rated company that offers friendly and professional removals services.Our featured services includes domestic moves ...
RepStevenBLuis, Data Scientist at Achieve Internet
Choose the best quality vaping accessories at Ny Vape Shop. With different types of quality vaporizers, we are one of ...
RepHazelMiller, Site Reliability Engineer at Delve Networks
Hazel Miller has been a stalwart advocate for sound public policy that advances the jobs creating potential of America’s ...
RepLarry Alvarez, Analyst at ASU
Prestige Luxury Rentals is one of the most renowned car rental companies in USA. We are locally owned and operated ...
RepSCREENish employee time tracking software can be used as desktop or mobile app. Once the employee has tracked his working ...
RepHad a brief career donating velcro in Africa. Spent several years training sock monkeys in Pensacola, FL. Gifted in working ...
Repcrystaljben, Technical Architect at Expedia
Hello, I am Crystal. I am a master’s prepared Registered Nurse with over 2 years clinical experience in addiction ...
This is a typical type of questions Amz is asking now a days.. It is straight a question to see how you come up with possible solutions
- hprem991 May 30, 20191> You gotto ask a lotta questions for this. You cannot assume anything
2> Clearly there is a ton of ambiguity here. Are you provided with a mapping? if not how are you able to certainly determine atleast a one key of an alphabhet
3> If you were able to make one work mapping, is it certain that the rest of the letter are just one n one mapping? or it is just a random mapping and you are to find the whole mapping first even before trying to find a word.
Unless you know these questions, there is no way you can progress to determine the rest of the process.