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
^ *Exactly,* Things are the *same all around the globe *in terms of
hiring procedure for programming positions. However I don't understand *this
is India *part?
Kindly reply only *when you think you are contributing something to the
community.*
Saurabh Singh
B.Tech (Computer Science)
MNNIT
I dislike interview questions which place arbitrary restrictions on
the solver.
It may be a good puzzle, but it's not a good interview question.
Print the numbers 1 to 100 without using a loop.
Why would you want to do that?
Divide a number by 5 without using the divide operator.
Again, why?
@don , becoz this is India...and shit happens everywhere
On Wed, Dec 12, 2012 at 11:48 PM, Don dondod...@gmail.com wrote:
I dislike interview questions which place arbitrary restrictions on
the solver.
It may be a good puzzle, but it's not a good interview question.
Print the numbers 1
Minimum number of cuts can be 1 and maximum can be n-1. Lets assume c
number of cuts 1= c = n-1 are required.
So brute force says :
iterate c 1 to n-1
and for these c cuts there would be (n-1)Cc combinations because there
are n-1 places in a1, a2,a3...an where these cuts can appear.
complexity
can someone just expain the plain simple logic used to solve this
problem ??
Cdn't get it seeing the code
On Jan 11, 10:08 pm, Jammy xujiayiy...@gmail.com wrote:
There are apparently more than one way to make the cuts(totally it'll
still be three). The code only outputs first possible.
On Jan
@Arpit Please explain your solution to me. As far as I understand,
every alternate of two person should sum up equally. Which means
every pair of (john, mary) has the same sum for john and mary.
On Jan 11, 2:55 am, Arpit Sood soodfi...@gmail.com wrote:
@jammy your code isnt working for the
oh, i considered that the sum of the total numbers for both john and mary to
be equal after the whole division process. I am not considering pair wise
sum.
That's why for input
1 4 5 6 2 2 2 2 4 5 6 1 1 7 8 8 1 7
segments should be:
(John)1 4 5 6 2 2 - (Mary)2 2 4 5 6 1 1 7 8 -- (John) 8 1
There are apparently more than one way to make the cuts(totally it'll
still be three). The code only outputs first possible.
On Jan 11, 10:42 am, Arpit Sood soodfi...@gmail.com wrote:
oh, i considered that the sum of the total numbers for both john and mary to
be equal after the whole division
any one with basic approach for these kind of problems
On Mon, Jan 10, 2011 at 11:38 PM, shady sinv...@gmail.com wrote:
Given an array of numbers : a1, a2, a3. an
(a)divide them in such a way that every alternate segment is given to
two persons john and mary, equally the
Heard of In place shuffle!!!
http://arxiv.org/PS_cache/arxiv/pdf/0805/0805.1598v1.pdf
On Mon, Jan 10, 2011 at 10:32 AM, shady sinv...@gmail.com wrote:
any one with basic approach for these kind of problems
On Mon, Jan 10, 2011 at 11:38 PM, shady sinv...@gmail.com wrote:
Given an
(a) it is intuitive to see we need to make a recursive function which
takes the following arguments:
1) array,
2) start index,
3) length of the array,
4) a sentinel indicating if it is the first half or second half
5) a sum if it is the second half
6) number of cuts so far
the output for first test case is wrong it should be
(John)1 4 5 6 2 2 - (Mary)2 2 4 5 6 1 1 7 8 -- (Mary) 8 1 7
minimum cuts made are 2
On Tue, Jan 11, 2011 at 10:04 AM, Jammy xujiayiy...@gmail.com wrote:
(a) it is intuitive to see we need to make a recursive function which
takes
@jammy your code isnt working for the mentioned test case.
One simple approach is to go greedy on the test data, but that wont always
give the optimum answer.
On Tue, Jan 11, 2011 at 1:11 PM, Arpit Sood soodfi...@gmail.com wrote:
the output for first test case is wrong it should be
(John)1 4 5
@ashish. u r getting wrong if else makes complete unit so if 1
fails other executes..no doubt in these..its not tough as much as u
taking it
what ii think some guys r right i got same solution..i don't thinsg
to xplain becoz, kathir,ankur has xplained same... answer will be
2812
Dear Shashank
What will get executed if AB and CD, then will foo2 get executed? NO
In worst cast(when AB and CD happens at same time i.e.25%), the foo2 fn
will get executed 50% i.e. 2500 times
Don't get me wrong, but closed mind is one of the reason people get
rejected.
Best Regards
Ashish
ashish , nobody is fighting here , but are u sure you are clear on
your probability concepts ? independent events do multiply .
what is the probability that when we toss three coins , we get all three heads ?
On Tue, Dec 21, 2010 at 6:45 PM, Ashish Goel ashg...@gmail.com wrote:
Dear Shashank
this is not probability purely...there is an else in between :)
why don't you write the program and test it out yourself :)
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Tue, Dec 21, 2010 at 6:52 PM, Ankur Khurana
can you provide the test cases ?
between ,
btw answer my question abt the tosses. plus closed mind argument goes
both ways. i have tried to explain.
if you dont want to understand , it is nobody's prob.wont comment
further on this topic.
On Tue, Dec 21, 2010 at 6:55 PM, Ashish Goel
test
a] AB, CD
b] AB, CD
c] A=B, CD,
d] AB, CD
e] AB, CD
f] A=B, CD
g] A=B, C=D
AB is 25% means the case could be a or d 25% in both cases CD does not
get executed as if condition is satisfied
and CD is 75% means case could be a or b or c. in case a foo2 will not get
executed but in b,c it
CD was 75%. no ?
On Tue, Dec 21, 2010 at 7:16 PM, Ashish Goel ashg...@gmail.com wrote:
test
a] AB, CD
b] AB, CD
c] A=B, CD,
d] AB, CD
e] AB, CD
f] A=B, CD
g] A=B, C=D
AB is 25% means the case could be a or d 25% in both cases CD does not
get executed as if condition is satisfied
and
what i think is that the number of times foo2 being called is
independent of the percentages given in the question it may be called
5000 times or 4999 times and continuinf in this fashion also none of
the times as in every case there's 1/4 probability of AB and 3/4 of
CD so as per me we cannot
The function foo2 will be called iff the condition if(CD) evaluates to be true.
Given that CD turns out to be true 75% times.So why the call to foo2
will be independent??
I think it is only the simple math.Correct me if I am wrong..
On 12/15/10, ankit sablok ankit4...@gmail.com wrote:
what i
well i still believe that the calling of foo2 is independent plzzz suggest
me the solution if i am wrong a detailed one thanx in advance
On Wed, Dec 15, 2010 at 1:22 AM, Saurabh Koar saurabhkoar...@gmail.comwrote:
The function foo2 will be called iff the condition if(CD) evaluates to be
true.
(1-0.25)* 0.75*5000 = 2812.5
On Wed, Dec 15, 2010 at 9:31 AM, ankit sablok ankit4...@gmail.com wrote:
well i still believe that the calling of foo2 is independent plzzz suggest
me the solution if i am wrong a detailed one thanx in advance
On Wed, Dec 15, 2010 at 1:22 AM, Saurabh Koar
@Sravan: Plz explain the logic..
On 12/15/10, Sravan Akepati sravan.akep...@gmail.com wrote:
(1-0.25)* 0.75*5000 = 2812.5
On Wed, Dec 15, 2010 at 9:31 AM, ankit sablok ankit4...@gmail.com wrote:
well i still believe that the calling of foo2 is independent plzzz suggest
me the solution if i
@Sravan
There seems to be a little problem in your solution. Your are probably
assuming that 75% of C is less than D after the condition that A is greater
than B while thats not the case according to the question.
My Solution -
Out of 5000 cases, AB in 3750 of them and CD in 3750 of them again.
Hi!
Assume 5000 test cases of A,B,C,D.. and The probabilities are as
mentioned above.
Then If loop will fail for 75% of test cases and else will be
executed.. In that 75% test cases, only 75% test cases will satisfy
the inner if statement..
So 3/4 * 3/4 = 9/16.
9/16 * 5000 = 2812..
I guess
i think sravan is right. we go to CD condition after AB have failed.
For that to happen, we have prob. of .75 . now the probability of CD
is .75 . so total probability is .75 * .75 as both are mutualy
exclusive events. so total no. foo2 is called is 2812.5 .
On Wed, Dec 15, 2010 at 11:55 AM,
I think, we must give answers in the range..
See, what happens if the
Test cases which doesn't satisfy (AB) can be the test cases which
satisfy the condition (CD)
In that scenario,
!(AB) and (CD) co-occurs, Ouput will be 3/4 *1 * 5000 = 3750..
o.w, Worst case , 3/4 * 2/3 * 5000 = 2500 ..
it' probability , how do we define best or worst in probability ?
On Wed, Dec 15, 2010 at 12:25 PM, Kathir kathirch...@gmail.com wrote:
I think, we must give answers in the range..
See, what happens if the
Test cases which doesn't satisfy (AB) can be the test cases which
satisfy the
Guys, We are anticipating an algorithm here.
The input would be an array containing 0/1 representing black and
white boxes.
On Sep 1, 8:37 pm, yash yashpal.j...@gmail.com wrote:
Given a chessboard in which u dont know how the black and white boxes
are arranged but this is sure that there will
Can anyone recheck and rephrase the question becuase i think it would
be always '0'
On Wed, Sep 2, 2009 at 10:40 AM, Naynnayanish.hi...@gmail.com wrote:
Guys, We are anticipating an algorithm here.
The input would be an array containing 0/1 representing black and
white boxes.
On Sep 1,
1 or 2
depends if diagonal sqaure are considered to be same as adjacent
On Wed, Sep 2, 2009 at 8:28 PM, Nagendra Kumar nagendra@gmail.comwrote:
Can anyone recheck and rephrase the question becuase i think it would
be always '0'
On Wed, Sep 2, 2009 at 10:40 AM,
@all: Yah it's 100% true that for 32 white and 32 black we have min
distance at 0.
But question will become difficult when the number of white
and blacks are less than 32.
-Nagendra
On Tue, Sep 1, 2009 at 9:30 PM, Ramaswamy Rramaswam...@gmail.com wrote:
If the white and the black
35 matches
Mail list logo