Re: [algogeeks] Adobe Interview Question

2012-12-16 Thread manish untwal
file redirection!! i did that too i was finding myself helplessi tried every thing!! as a result, i missed on this question On Wed, Dec 12, 2012 at 8:53 AM, saurabh singh saurab...@gmail.com wrote: I would have replied back with I am doing it with C programming language only. the read

[algogeeks] Amazon interview Question

2012-12-16 Thread tapan rathi
For a given number, find the next greatest number which is just greater than previous one and made up of same digits. --

[algogeeks] Re: Adobe Interview Question

2012-12-16 Thread Devendra Singh
Problem 2) of generating permutations from a string was asked to me in Virtusa Tech Interview On Sunday, December 9, 2012 3:22:19 PM UTC+5:30, manish untwal wrote: I gave this interview in August this year, two of the question i was not able to answer properly 1) how to print the

[algogeeks] Re: adobe apti question

2012-12-16 Thread marti
Yes I feel (e) is the right option. On Sunday, December 16, 2012 11:18:57 PM UTC+5:30, rahul sharma wrote: A causes B or C, but not both F occurs only if B occurs D occurs if B or C occurs E occurs only if C occurs J occurs only if E or F occurs D causes G,H or both H occurs if E occurs

[algogeeks] Re: Amazon interview Question

2012-12-16 Thread marti
Here is what you do EG: 5436782 ans is 5436872 how did we arrive? FInd least index i, such that a[i-1] = a[i] starting from rigthmost 5436782 (8) Now , Find least index j such that a[j-1] = a[i-1]: 5436782 (7) swap them = 5436872 Now swap all values between i and j.

Re: [algogeeks] Re: adobe apti question

2012-12-16 Thread Shubham Sandeep
according to me option c holds Reason:it is either that FG or EH pair occurs but both pairs cannot occur as one is an oucome of B while other holds if C occurs. since either B or C (but not both) may follow A... so point prooved. but D will always be there weather B or C follows after A. since

Re: [algogeeks] Re: Amazon interview Question

2012-12-16 Thread Shubham Sandeep
hello all... anwer to previous example would be 5436827 instead of 5436872please correct it :) On Sun, Dec 16, 2012 at 11:48 PM, marti amritsa...@gmail.com wrote: Here is what you do EG: 5436782 ans is 5436872 how did we arrive? FInd least index i, such that a[i-1] = a[i] starting from

Re: [algogeeks] Re: adobe apti question

2012-12-16 Thread rahul sharma
I got it from aomewhr .answer given is e... E option is wrng as per my opinion.. It should be 13 or 23 instead of 12or23 am i ryt? On Mon, Dec 17, 2012 at 12:03 AM, Shubham Sandeep s.shubhamsand...@gmail.com wrote: according to me option c holds Reason:it is either that FG or EH pair

Re: [algogeeks] Amazon interview Question

2012-12-16 Thread Anurag Gupta
loop from the end of given number till you get a digit less than the previously scanned digit.Let the index of that number be 'i' . if index = -1,then the given number is the largest one else do the following 1) swap the digit at the index i with the digit just greater than it in the scanned

Re: [algogeeks] Re: Amazon interview Question

2012-12-16 Thread ramchandra sankhala
Let the number is stored in an array a[n] with MSB at index 0... 1. i = n-1; reduce i till a[i]=a[i-1] i 0. If here i =0 means give number is largest possible number made out of digits otherwise i is pointing to a digit such that a[i]a[i+1] 2. find smallest digit from a[i+1 to n-1] just

[algogeeks] Re: Amazon interview Question

2012-12-16 Thread marti
Yeah thanks Sandeep, theres an error in example...it should be 5436827.However there is no need to sort. On Friday, December 14, 2012 11:56:16 AM UTC+5:30, tapan rathi wrote: For a given number, find the next greatest number which is just greater than previous one and made up of same digits.

[algogeeks] Re: adobe apti question

2012-12-16 Thread marti
Yes Rahul Sharma. you are right. the ans is 1and3 or 2and3 On Sunday, December 16, 2012 11:18:57 PM UTC+5:30, rahul sharma wrote: A causes B or C, but not both F occurs only if B occurs D occurs if B or C occurs E occurs only if C occurs J occurs only if E or F occurs D causes G,H or both