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
Assuming a is the given array of n * m dimension.
for (int i=0;i<=n;i++)
{
int array=new int[m];
for(int j=0;j<m;j++)
{
if(((a[j]+1)==a[j+1])||(a[j]-1)==a[j+1])
{
array[j]=a[j];
}
if(((a[j-1]+1)==a[j])||((a[j-1]-1)==a[j])))
{
array[j]=a[j];
}
}
print this array.length
}
@Aka .. Lol .. Haha Well I am not here to earn Votes, Which I got enough but I understand your doubt about all array being negative numbers right.. Than neither of the above mentioned DP soln handles this Special scenario.
However, I assume that too ain't an issue coz, when U summarize all the value it ends up same thing. and our math comparision operator is enough to handle this. I mean -1 is still bigger than -2 . ;)
Okei that before adding up the number make sure that negative number should not be taken into consideration.
I mean its still stands the same procedure with O(n) complexity ?
Actually I don't see the need of usage of DP at all here. Of course you can beautify with the implementation.
Guys, I got bit confused here . I mean the subset of the given set without adjacent number included. Its clear case for me that:-
1> add all value in even place and store in variable 1 ,
2> add all value in odd place and store in variable 2.
Now whichever is greater sum return it.
Is it what the question is asking for ?
@Anon.. You are a true Microsoft guy. Sorry if I hurt your feelings but all I wanted to say is this guy (Who raised this question), who seems to have a bright candidate and could have a bright career can think of doing great job without any distraction at all.
For your own satisfaction, please don't look into online review, talk with individuals who have been through. Rest depends how do U perceive your environment, if you can survive in that, its definitely great place for you to be. After all your happiness and satisfaction counts ..
Well my Math Says so.
1> Loop 1 runs upto (n-1)
2> Loop 2 runs upto (n-1)*n(Square)/2 , coz its summation where n is infact (n-1) here.
3> Loop 3 this is the most complex one, which my calculation shows whopping
((n-1)*n(Square))/4*((n-1)*n(Square)/2+1)
Now Final Formula is the Product of Loop 1 * Loop 2 * Loop 3 . Which is Strange ..
@ Anon :- I donno about the Yahoo current status but looking at the record from the past history , Yahoo never really overcome 2001 ( Bubble ). I have some of my Buddies over there and they says some of the facilities has been reduced, which becomes evident by their change of numerous CEO's in recent times.
Oh the Other hand MS , which literally remains only as a name but no real tech work. Bright Friends over has already moved or planning to move out. Its not the org you would wanna join as a tech engineer ( May be Best for politicians and lawyer ).
IMO, in this case, MS does not exist in the picture for an Engineer like me. :)
@Anonymous. Thanks for pointing out CAP which is obviously cannot be beaten. Specially the "Partition Tolerance" coz the system like this has to be capable of overcoming fault tolerance if any one of the server goes down or got hacked.
Apart from that, I assume this is middleware approach to tackle this as you mentioned lower layer has even better protection.
@aka :- Thats excellent approach you explained above at Embedded Level for overcoming Conflict. The Same can be applied as well.
In middleware there is yet another way of doing so is blocking of Critical Section approach, using threads or Semaphore. Over the time in which the section of code updation is going on, here so called Base Server has to ensure that everyone is in sync but meanwhile it can accept that all other incoming increment request and can accumulate in his queue.
There are many ways to do so.
1> Cache Coherence technique is highly used in industry scale. Specially at hardware level.
2> Another approach which I could think of is as follows.
Make a Counter Base Class and maintain in one of the Server. Rest of the remaining server may act only as the supplement support , which holds the copy of the counter class object ( May be we can scale using Derived Class of this Base Class ).
Now, the counter update is not a simple counter increment but a queue, Once a counter gets incremented by any of the server, it process that by sending a increment info to the queue which is maintained by base server.
Base Server has to do 2 task,
1> Process the queue operation sequentially and in some routine time manner.
2> Once, the operation is completed, send the updated counter value to each of the corresponding associated servers.
Question here might resemble to some graph theory.May be Prim's Algo can be implemented here.
First, row first column will have all 0's.
Second row will have 1's to only those who are their ancestor. Now Algo follows the same pattern Subsequently except on one occasion, where if the node parent has marked 1 on its ancestor to some other node, then this node also have to mark 1 for that node .
I am sorry but it seems like I got this question in different way and I could only get this in Polynomial time.
I mean using binomial theorem it get ( N is a variable number of Die and F is a variable number of faces of each die) so
N1(F)+N2(F)......N(n-1)(F)+N(n)(F)=S
Which clearly frames polynomial expression.
Any Pointers??
Lil bit Unclear buddy .
1> Total Color Available is 26 (a-z) out of which U can only take any 10 colors to fill the array ??
2> If U are allowed to Swap than U can write a small sorting of your own .. Not allowed ??
3> What is the time and Space compromise restriction over here?
Following are my suggestion :-
Method 1 :-
1> First Stroke :- Cut Horizontal.
2> Second Stroke :- Cut Vertical.
3> Third Stroke :- Cut Across the Height of the Cake.
Method 2:-
1> First Stroke :- Cut Horizontal.
2> Second Stroke :- Cut Vertical.
3> Pick each of these pieces and stack upon each other making a pile of 4 pieces.
4> Third Stroke :- Cut through all the 4 pieces.
No. Once you are disqualified for any position, your resume will be blocked at Amazon Recruitment for at-least of 6 months.
Although, I doubt this restriction remains across various countries but it is said as the candidate profile is reflected thought out Amazon offices, you are no longer a valid candidate to re-apply even at other countries during this 6 month.
There can be many approaches to solve it.
As for URL example is concerned we can use the Linear proving mechanism of Hashing. for each URL we can append a new node of timestamp for everytime access.
However generally , the basic many to many relationship can be best represented by Graph ( Directed graph ).
DropBox works on the principle of Cloud Computing meaning all the data you uploaded will be stored in the HUGE Server and also on the application from where you have uploaded.( Say from your desktop etc) Once, you downloaded it, the same thing happens, It won't get delete until U manually delete it by yourself.
- hprem991 April 25, 2013I am not sure if the issue is completely resolved but there seems to have been some compromise script running ( Which is creating some delay in display).
Try to open a question which has many comments to see how much time will it takes to display it properly. Seems like your AJAX is taking few moment to process the comment evaluation ( User can easily see "Comment is Hidden.. " Text for Sometimes).
1> Place 3 balls on each side of balance
2> If it is balanced, Put the remaining 2 of the balls on the second iteration and find the different.
3> If not balances, take out the 3 balls of the side which is heavier and put 2 balls among these 3 in the second iteration.
4> If it is balanced, the 3rd one is the heavy else, the one the one with the heavier side is heavy.
There is two possible solution for the same.
1> If you want just to refer double pointer the address of the char *a[]. Just do b=(char **)a; // Most Framework use this approach.
2> If you want to deep copy each of the char *a[] to char **b[]. You need to copy each element and put into double pointer array.
One of the solution can be using min heap of size (1000).i.e heap at any instance contains at most 1000 maximum elements.
Algo :-
1> For each input element compare the element with the root element of the heap.
2> if value(root) > value(element) ; replace root with input element and heapify
Time Complexity - O(nlogn).
Well, this issue were there from a long while. Infact, I believe, before mandating the logger's identity to vote or chat, people have enormously exploited the system's flexibility.
However, I would encourage you to participate on the discussion and contribute your understanding over the matter, regardless of the reputation you gain.
This site is to focus on helping others by your contribution. So , don't take into account of what other think and vote.
Keep it on man.
printf(5+"HelloIam") means print the character from 5 pos onwards till the end of the given string.
printf("%s",5["HelloIam"]) means print 5 element from the array [""], unfortunately your array is short of the element as you have only one element declared inside the array.i.e. within a quote, Hence compiler won't able to find the element being asked creating segmentation.
Well I checked the above link and I think we can do a bit modification on that.
Algo Here.
1> Start with 2 pointer both pointing at first node.
2> Run k loops and progress pointer 2 to k distance off the first node.
3> Point pointer 3 = pointer 2 to here and continue looping with both pointer 1 and pointer 2 progressing onwards till pointer 2 hit end of loop.
4> Now. Pointer 3 is at k distance from start and pointer 1 is at kth distance from the end.
Now simple this will do the job.
struct List *point=(*struct List)malloc(sizeof(Struct list));
point->data=pointer1->data;
pointer1->data = pointer3->data,
pointer3->data= point->data;
free(point);
and free the rest of the pointer.
First, we all know what is generic implementation is. Probably in C++ we use template.
In plain C and most embedded technologies ,we use void pointer for generic implementation in C which is basically used to type cast to any other type of valid pointer.
So. what if we use unsigned int to do similar kind of generic implementation.
Firstly can it be done ?? Well we have certain API's in Win 32 library which use unsigned int and share the address space to make the generic behavior of API's.
So, typically we can make an API generic by void pointer and unsigned int (As we can see in numeric examples).. So the question here is what causes the developer to prefer one over other and why?
Whats the advantage and disadvantages of one over other ??
NOTE :- Now for those who has given lot of idiotic comments as I can see.. need to understand the question properly.. Hope it will help you guys to open your eyes before puttinf any more stupid comments.. :)
Well I guess there are couple of ways we can approach this
1> Design API such that it only Process the functionality and no memory allocation within it.
2> Use the Smart pointer concept for every pointer usage within the API.
3> Can make API's so that for every allocation there must be the deallocation called in. for every condition.
Well.. than U are jst show what is your level of deep understanding on the subject. I guess U need to first understand before wasting your unnecessary effort to put the comments..
Anyways thanks for highlight how Stupid and coward are U to put comment without name..
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 ...
Basically its the creation of 2 Arrays.
- hprem991 October 01, 20131> One Array to the left of the equation where we read each element and then multiply by the number of occurrences.
2> Array two does the same but on the left hand side of the equation.
We can use the hash to decrease the time complexity by taking the hash bucket as 26 (max number of alphabet.)
For First array we populate the hash table by the number of occurrences and the next array can be use to remove the entry from the table by the number of occurrences.
Now , we can get the final value from the hash table along with the corresponding alphabet and occurences to be match
if Hash table is empty mean balances.
if value of an alphabet is negative means need to put values on left side of the equation.
if value is positive means same to be done on right hand side.
Time :- O(n)