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
oops
On Aug 28, 7:09 pm, Decipher ankurseth...@gmail.com wrote:
@vikas - As i said earlier think in 3D . The correct answer is (sqrt(3) -
1)R/(sqrt(3) + 1) = r
Using 3D coordinate geometry if (R,R,R) and (r,r,r) are the coordinates of
center of large and small sphere . Then , make
@vikas - As i said earlier think in 3D . The correct answer is (sqrt(3) -
1)R/(sqrt(3) + 1) = r
Using 3D coordinate geometry if (R,R,R) and (r,r,r) are the coordinates of
center of large and small sphere . Then , make distance formula for centers
of sphere in 3D = (R+r)
*Now don't ask
think in 2d and I assume that both the sphere are touching each other.
it should be simple 2d maths now :)
On Aug 25, 8:32 pm, rakesh kumar rockey.rav...@gmail.com wrote:
Could you explain the solution for shere problem
On Thu, Aug 25, 2011 at 3:49 PM, vikas vikas.rastogi2...@gmail.com
@ All,
1. build a interval tree using startpoints as the key
2. augment this tree such that each interval contains the number of
ppl arrived, in this case 1.
3. use this tree and traverse , use this check, if start/end of tree
node is inbetween the interval you are searching, person was
5th qs
r = R(3-2sqrt(2))
On Aug 25, 1:56 pm, vikas vikas.rastogi2...@gmail.com wrote:
@ All,
1. build a interval tree using startpoints as the key
2. augment this tree such that each interval contains the number of
ppl arrived, in this case 1.
3. use this tree and traverse , use this
@Diye True :)
Shashank
CSE,BIT Mesra
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/O_KMuq1YK_0J.
To post to this group, send email to
Could you explain the solution for shere problem
On Thu, Aug 25, 2011 at 3:49 PM, vikas vikas.rastogi2...@gmail.com wrote:
5th qs
r = R(3-2sqrt(2))
On Aug 25, 1:56 pm, vikas vikas.rastogi2...@gmail.com wrote:
@ All,
1. build a interval tree using startpoints as the key
2. augment
Hi All,
for checkouts problem how about finding the median for all the times
8-00 8-15 830
sort the second list
8-30 900 920
if we take the mediun of whole list then it will be 8-30 where max no of
people will be present
Will it work..
Any body has any idea??
On Wed, Aug 24, 2011 at
Hi
Anybody has answer for sphere problem...could you please proivde
On Wed, Aug 24, 2011 at 9:10 PM, rakesh kumar rockey.rav...@gmail.comwrote:
Hi All,
for checkouts problem how about finding the median for all the times
8-00 8-15 830
sort the second list
8-30 900 920
if we take the
@vikas: can you please put some light over interval graph to solve this
problem or provide some useful links??
On Mon, Aug 22, 2011 at 6:47 PM, Decipher ankurseth...@gmail.com wrote:
@vikas - Can u post ur answer using segment trees ??
--
You received this message because you are subscribed
Well, strictly speaking, you don't need any complex data structures:
*1. Create an array of entities*
eg. Person data[100];
where
struct Person {
// Person data
};
*2. Create an array of timestamps:*
Event time[200]; // Note: double the size of the Person data array. One for
start and one
using interval tree/segment tree will solve this in straightforward
fashion
On Aug 22, 12:41 pm, Jagannath Prasad Das jpdasi...@gmail.com wrote:
for the stick prob is the stick length required?
On Mon, Aug 22, 2011 at 12:48 PM, Jagannath Prasad Das
jpdasi...@gmail.comwrote:
i think
If an array is rotated a number of unknown times , then how to find an
element in O(log n)
For the above question, is the array already sorted???
On Mon, Aug 22, 2011 at 2:50 PM, vikas vikas.rastogi2...@gmail.com wrote:
using interval tree/segment tree will solve this in straightforward
Yup array is sorted first then rotated !!!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/1CYpZg2TLzYJ.
To post to this group, send email to
@vikas - Can u post ur answer using segment trees ??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/ssVg6dOuXiUJ.
To post to this group, send email to
oops sorry...it will be (root3-1)R/(root3+1)
...the above answer will be for 2d..
Ravi Shankar,
R D,HCL Comnet,
Noida,
Ph:995369
On Sat, Aug 20, 2011 at 4:04 PM, Ravi Shankar ravi.iiit...@gmail.comwrote:
I guess the correct answer is (root2-1)R/(root2+1)
?
Ravi Shankar,
R D, HCL
is it (root 2 - 1) * R ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/zwlqxDgQXFgJ.
To post to this group, send email to algogeeks@googlegroups.com.
To
(root2-1)R/root2+1??
On Fri, Aug 19, 2011 at 8:03 PM, Greeshma greeshma.0...@gmail.com wrote:
is it (root 2 - 1) * R ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
(root(2)-1)*r???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit
ya tats d ans i got..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/VRqgtJewfHsJ.
To post to this group, send email to algogeeks@googlegroups.com.
To
I don't know the answer since my friend who had given the interview was not
able to answer the questions . But remember its a SPHERE so think in 3-D
rather then 2-D and also please give the logic behind your answer .
--
You received this message because you are subscribed to the Google Groups
I could not visualize the situation, could please elaborate on the
positioning of the axis and the spheres?
You haven't told whether they are touching each other or not ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
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
You have N computers and [Ca, Cb] means a is connected to b and this
connectivity is symmetric and transitive. then write a program which
checks that all computers are interconnected and talk two each other?
Regards
Shashank
--
You received this message because you are subscribed to the Google
Simple BFS or DFS solves this problem.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For
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
I think first we need to sort the boxes in decreasing order of
height , width and length so that input like this (7,8,9),(5,6,8),
(5,8,7),(4,4,4),(3,2,1),(9,9,10),(9,3,7) becomes
(9,9,10),(9,3,7),(7,8,9),(5,8,7),(5,6,8),(4,4,4),(3,2,1) . Now we can
apply DP here . Let dp[i] = maximum no. of boxes
I think first we need to sort the boxes in decreasing order of volume
so that input like this (7,8,9),(5,6,8),(5,8,7),(4,4,4),(3,2,1),
(9,9,10),(9,3,7) becomes (9,9,10),(7,8,9),(5,8,7),(5,6,8),(9,3,7),
(4,4,4),(3,2,1) . Now we can apply DP here . Let dp[i] = maximum no.
of boxes fitting into each
You should try to rotate boxes also - to simplify this, sort all dimensions
in ascending order.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group,
I think this is a modification of longest increasing subsequence
problem . First , sort by length then find the longest increasing
subsequence by width. Now, in this solution find longest increasing
subsequence by height . This would be the answer to this question.
--
You received this message
This is absolutely longest increasing sub-sequence problem.
Since rotation is not possible. For the given L and B values calculate the
base area L * B for all the given values and sort it. From this sorted array
calculate the longest increasing sub-sequence of H.
The Out put sequence gives the
@anand...A small correction, in that longest increasing subsequence
algorithm we also should make sure that the first two dimensions are also
proper. Because sorting two dimensions based on area doesnt mean they fit.
On Sat, Jan 8, 2011 at 4:40 AM, Anand anandut2...@gmail.com wrote:
This is
@nishaath you are correct.
On Fri, Jan 7, 2011 at 9:03 PM, nishaanth nishaant...@gmail.com wrote:
@anand...A small correction, in that longest increasing subsequence
algorithm we also should make sure that the first two dimensions are also
proper. Because sorting two dimensions based on area
Please write the recursive DP formula for this question .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
@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
67 matches
Mail list logo