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
For a given number, find the next greatest number which is just greater
than previous one and made up of same digits.
--
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
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
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.
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
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
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
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
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
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.
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
12 matches
Mail list logo