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
Well we all know that Array Access is faster of course .. The main reason is as follows
As it is just to iterate the loop , many may get confused as we need loop in both case but the main question here is..
Struct Node *ptr=node -> next;
and
array[counter+1].
Now if you beak this into assembly language, it is sure that array would hv lesser Instruction to execute than LL (people may try writing the assembly to verify).
Now as we knw the each instruction may take 1 / 2 / 3 CPU cycles to execute .. then you can verify why Array access always results faster than LL
Well thanks for the aggressive response but fellow if U can't code what U designed. Perhaps U should learn how to code than.. We in here are pretty much fluent in coding with more than 5 years of product development experience feels little bit more challenge to put correct algo before code.
With your expression it seems U are Fresher so yea U need to learn to code first before attempting anything stupid.. Happy Learning
class antGame has following member variables
1>movement is a enum or macro which have 4 possible value left,right,up and down;and nextCell is the type of cell like food, water and ant;
2> method move(string movement); Where the user can make the ant move to the cell specified by the movement value of nextcell as parameter.
3> method nextCell(string Cell,string movementl); will accept Cell as the current cell and next cell as the movement parameter and returns the output of the movement.
4> method nextCellContains(string Cell,string movement); accepts the same parameters but returns what is the content of the adjacent cell.
5> has a class Object ant(may be an independent class), which needs to be created by constructor and destroyed not only by destructor but also the dissolve movement.
6> Object ant has to be singleton and is accessible to two different antGame object.
The list will go on and on.. after discussion.. But really good question..
This is Straight O(n) Algo.
1> For each element in a list
2> Sum up the values.
3> track the largest value observed so far.
4> end of Loop
5> Eliminate the largest value from the summation . Sum - largest.
6> Divide the sum by the (counter-1) from the loop.
1-4 is O(n) and the 5,6 is constant 2 steps overall O(n)
There are certain psyco person like this "Anonymous" who does not even have enough gud to express his identity, ruining the technical discussion and moving down the correct idea at the bottom of the discussion.
I urge the users to just ignore the non-technical views and provide your own analysis.. I am going to report this mis conduct
Sorry man. if I disappointed ya..coz its not abt what u think its abt what is right.. So if U hv any trouble in understanding or hving better idea post it.. Don't take it personal..
Anyway.. lemme know if U donno how to find kth largest using Hash.. Coz Hash basically is used to find values with condition and here the condition is the largest value..
This question is a good test for the underlying understanding of tradeoff.
1> For Memory Compromise, I can use a Hash of k buckets to hold k different values which has a time advantage of O(k) but memory O(k)
2> For Time Compromise, I will use any sorting perhaps the merge sort which can provide the best of all giving O(nlogn) . (I m talking about Merge function without using extra additional array ).
Thats is good question buddy..but its way beyond the scope of this discussion..
Here is the glimpse..
All browser uses something called a web-engine.. Safari / Chrome uses something called "WebKit" an Open Source and Mozilla uses "Gecko".and so on and so forth..
The point here is the pluggin implementation depend on what browser and so what web-engine are U using..
Say for Mozilla. they have some interface called "npapi" which is actually a interface to use the browser api for integration and what U gotto do is U gotto design the pluggin and use those specific npapi pluggin to browser to support.
Now other other part of the question is creating a GPS module itself which can be done using network api of the kind of the application you are designing.
I can keep going but its way way above the scope here..
This can be done in O(n), the same question I hv done in Amz .
Algo here.
1> Trace the path of node one from the root to child and store all the values in an array1. O(n).
2> Trance the path of node two from the root to child and store all the values in array 2. O (n).
Now U gotto check Index by Index in array 1 and array 2. Just before first index that mismatched is the common ancestor.
Total Time is . O(n)+O(n)+ O(n) = 3*O(n) ~O(n)..
Remember assuming the tree is completely unordered we requires O(n) coz we are assuming its flat out. else if we hv any pattern we can utilize the same..
Guys I need bit more explanation here.
As per the given question, player's don't have any benefit or restriction. I mean, how can a player A choose ?? as it is certain he must have to pick a pot and that too present in a certain position.. Is there any option for him to skip a pot if he did not wish to collect it ?? How can the decision is been generated ? without that the game is straight forward and is totally depends upon arrangement of pots rather than player
Good Question
We can have the following approach
class GPS have the following methods
1> getLongitude() which will connect to the network and get the longitude value of it and return the double.
2> Similarly getLatitude() and getaltitude() returning corresponding double values.
3> Similarly we need one more method called getPosition(double longitude,double latitude, double altitute), which will accept these values and calculate the point of intersection as the current position.
Very Lucky Fellow to get this question @ FB... Here it goes
1> Reverse Each String . O(n) + O(m)
2> Pointer p1 and p2 to string 1 and 2 respectively.
3> Set Overflow = 0;
4> string *s;
5> Loop until each string finishes
{
s=*p1+*p2+overflow;
overflow=*p1+*p2;
if(overflow==2)
overflow =1;
else
overflow=0;
p1++;
p2++;
s++;
}
Total Time = O(n)+O(m)+O(m or n {which ever is higher})
Well I can answer this in terms of Software Lock.
1> Use some map or even 2 dimensional array / vector will do.
2> First index use to determine whether we can do the operation on the second index value.
3> Second index use the memory location where the object in context resides.
4> Once the process gets the access change the value of first index to "NOT OPERATABLE" State and release back once it stops its execution.
Disadvantage :-
The Scheduler itself is not thread safe.
There are many ways to implement this in C++
Basically it runs on the algo where you need to make sure the Object in Context is having any reference or not.
One simple implementation uses something called a Counter Class which basically Counts the number of reference to a particular object. So when the reference becomes 0, it deallocates the memory.
Another and more prominent way uses something more in complex algo. This is a daemon that is schedule to run periodic to check the object is in the state of removal or not and for every such check it increments the counter. Actually this algo is beyond the scope of discussion here but being real time implemented in case of JVM Garbage Collector.
My Algo goes here
1> Say U have one link list with head as a pointer (Given Link List)
2> Create another link List and reverse it . O(n) + O (n)
3> For each node in any of the list until n is list.length / 2
Create a new list with value one from list 1 and one from list 2
advance the pointer in both list
end of loop
My Algo Goes here.
1> float value= Index / 20;
2> if(index=="Even") {
if(value.decimals() is between 0.00 to 0.49)
{
cout<<"Value is "<<floor(value)
} else {
cout<<"Value is ""<<Celing(value);
}
}
3> if(index=="odd")
if(value.decimals() is between 0.00 to 0.49)
{
int least_index=index%20;
// Use following mapping
if (least_index==1)
cout<<"Value is 0"<<endl;
if (least_index==3)
cout<<"Value is 1"<<endl;
if (least_index==5)
cout<<"Value is 2"<<endl;
if (least_index==7)
cout<<"Value is 3"<<endl;
if (least_index==9)
cout<<"Value is 4"<<endl;
} else {
if(value.decimals() is between 0.50 to 0.99)
{
int least_index=index%20;
// Use following mapping
if (least_index==1)
cout<<"Value is 5"<<endl;
if (least_index==3)
cout<<"Value is 6"<<endl;
if (least_index==5)
cout<<"Value is 7"<<endl;
if (least_index==7)
cout<<"Value is 8"<<endl;
if (least_index==9)
cout<<"Value is 9"<<endl;
}
}
First of all.. How did U get calls from org like Apple.. Damn Lucky...
Now ,Here we go my approach..
1> First we will assume that the memory is a fixed set of array(Coz its address is continious)
2> Now we can use the same malloc signature. i.e. size to allocate and return if it is possible or not.
void * mymalloc(int size)
{
/* Consume the memory from this array */
}
Now testing this is very important.
What if all the memory is used? etc
Now this is really a Great question..
My Approach would have been as follows.
1> Class Cube contains.. Following methods
A> Rotate which contains two parameters and return success or failure.First the direction of rotation and second the number of rotation. Direction is a enum with up/down and right/left value.
B> Verify which contains two parameters and returns where position it mismatched. First the position of a piece and second the array of number of surroundings pieces(For centre key it will contain 8 or maximum value in the array). You can calculate the color of the particular piece by using another method.
C> Color which will have again two parametes and returns the color type.The piece position and the face on which the piece lies. For reference we can name faces as 1 to 6.
Haha Please Change "Demormalisation" to DeNormalization... Coz nothing is gonna hamper morals..
Anyways..
Basically we need to normalise Stuffs ( I hope in this context DB ) to make sure there is not redundancy ... the performance enhancement occurs in two ways
1> No redundant data means Space utilisation minimal.
2> It helps to search the record easily coz we know the interconnection of the tables easily.. So optimization of execution time..
Singleton is a DP where only a single object of the class can be created.
class Singleton{
private :
Singleton();// Constructor is private
public :
Singleton & getInstance()
{
// Add thread lock here to make it thread safe
if(!object)
object=new Singleton();
// Release Lock
return object;
}
}
static *Singleton object=NULL; // Static Object must in C++ not required in Java
Well.. I remember the famous "Prison Break" Breakdown with the question.. ;)
Anyways.. I guess the algo Approach would be Something like this
Vector<char> words[27];
For each element1 in {abc}
For each element2 in {def}
For each element3 in {ghi}
if(dictonary(element1element2element3))
Word[index++]= element1element2element3;
end loop
end loop
end loop
Assuming dictonary is a function returning true if word exist else false.
O(n3).. time compexity.. ;(
Well.. I also have a doubt on this question.. if it is what U explained above.. all you are doing is pointing to the memory location where the integer is and framing it to string or char *.
Probably the acsii string means an equivalent character string .. is it so ?
Well I guess this guy is in the funny mood to ask this kinda question. However, I have the humorous solution for him..
Why don't U give a code of any recursive or backtracking problem.
I would have given Tower of Hanoi with 512 disk.. Code will not take forever to finish yet it will have a great deal of time... haha
No hogging no wait no resource blocking
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 ...
Thats ethical issue.. If U think U should not do it.. Don't do.. But basically until the question is on the floor , it okey for U to proceed.. as you are not commiting to anyone else..
- hprem991 March 15, 2013Two Team in a same organisation may be treated as two organisation. till you have been offered otherwise.. :)