1.- if you use bitmask can be easy solved
2.- second aproach is create un recursion
string func(int idx, int cnt){
if(cnt==r)return ;;
string ans = func(idx+1, cnt);
if(cntr) ans = ans+\n + func(idx+1, cnt+1) + a[idx];
return ans;
}
On Sunday, May 19, 2013 10:08:10 AM UTC-5,
I would say that (c) is the correct answer.
III is the only one which MUST be true. We also know that I xor II
will be true, but that is not what option (e) says.
Don
On Dec 16, 12:48 pm, rahul sharma rahul23111...@gmail.com wrote:
A causes B or C, but not both
F occurs only if B occurs
D
agreed
On Mon, Dec 17, 2012 at 10:03 AM, marti amritsa...@gmail.com wrote:
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
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
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
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
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
^ *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
You could update fibb[n] before returning fib(n-1) + fib(n-2)
int fib(int n)
{
if ( n = 1 )
{
fibb[1]=n;
return n;
}
if (fibb[n] ! = 0 ) {
//return fibs(n-1)+fibs(n-2);
}
On Sunday, October 21, 2012 7:46:43 AM UTC-4, rahul sharma wrote:
You could store fibs[n-1] + fibs[n-2] in fibb[n] before returning.
int fib(int n)
{
if ( n = 1 )
{
fibb[1]=n;
return n;
}
if(fibb[n] != 0) {
return fibb[n];
}
fibb[n] = fibs[n-1] + fibs[n-2];
return fibb[n];
//return fibs(n-1)+fibs(n-2);
}
here's an O(lgn) soln :
matrix form of fib :
http://en.wikipedia.org/wiki/Fibonacci_number#Matrix_form
and then use the divide and conquer for calculating (A)^n in O(lgn).
Thanks
On Sun, Oct 21, 2012 at 7:10 PM, rahul sharma rahul23111...@gmail.comwrote:
I have implemented this code below:-
int temp = {[1(j-+1)]i-1};
Here temp is a number with all the bits set between positions i j [both
inclusive]
temp = ~temp;
N = N temp; // here we are clearing all the bits of N from
position i to j
temp = temp | M; // now we are taking the bit pattern from M into temp
this is from KR exercise :)
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Wed, Sep 12, 2012 at 4:14 PM, Navin Gupta navin.nit...@gmail.com wrote:
int temp = {[1(j-+1)]i-1};
Here temp is a number with all the bits set between positions i j
arr1 = (int *)malloc(sizeof(int) * ncols);// memory allocated for 1st
row
arr2 = (int **)malloc(sizeof(arr1) * nrows);
I haven't tried it.So,please correct me if i am wrong
On Mon, Jul 2, 2012 at 12:55 PM, Rishabh Agarwal rishabh...@gmail.comwrote:
nrows: number of rows
ncols:
@abhishek its wrong as arr1 is just a pointer o int and sizeof(arr1)
will always be 4 bytes(size of a pointer) regardless of number of bytes
allocated to it on heap
On Tue, Jul 3, 2012 at 3:14 PM, Abhishek Sharma abhi120...@gmail.comwrote:
arr1 = (int *)malloc(sizeof(int) * ncols);
what s silly mistake. @Rahul thanks for correcting me.
On Tue, Jul 3, 2012 at 3:41 PM, rahul ranjan rahul.ranjan...@gmail.comwrote:
@abhishek its wrong as arr1 is just a pointer o int and sizeof(arr1)
will always be 4 bytes(size of a pointer) regardless of number of bytes
allocated to it
nrows: number of rows
ncols: number of columns
int **arra = (int **)malloc( sizeof(int*) * nrows );
int *ar = (int *)malloc( sizeof(int) * nrows * ncols );
for( int a = 0; a nrows; a ++ ) {
arra[a] = ar + ncols * a;
}
now index of array i and j can be
for second question think of the given string as some overlapping strings
with overlap length of length(pattern) -1.
now appy strstr/KMP in parallel to these substrings
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Tue, May 1, 2012 at 11:36
Q2. better approach will be using KMP or Boyce Moore.
--
*Thanks
Shashank Mani Narayan
Computer Science Engineering
Birla Institute of Technology,Mesra
**Founder Cracking The Code Lab http://shashank7s.blogspot.com/;
FB Page
Q1) Yes, as per my friend the only interface is that function. But how will
you traverse the matrix because if : BADCAT is one row then there are two
words BAD and CAT and you have to find both and it could be DAB and TAC
also ?
Q2) What will be the complexity when state machine is used ?
--
Q2 can be done using KMP algo or suffix tree
On Sun, Apr 1, 2012 at 1:12 PM, Decipher ankurseth...@gmail.com wrote:
Q1) Yes, as per my friend the only interface is that function. But how
will you traverse the matrix because if : BADCAT is one row then there are
two words BAD and CAT and you
Q1) The only interface to the dictionary is this binary function? It
would be very helpful to know if there are words in the dictionary
with a given prefix. If the requirement is to find all words in the
matrix, as you stated, there is not a better option than to loop over
every string which can
@all : doesnt sudhir's solution seem to work??
@sudhir: can u explain yr logic?
On Wed, Sep 21, 2011 at 8:31 AM, annarao kataru kataruanna...@gmail.comwrote:
can u explain the logic behind this
thanks in advance
--
You received this message because you are subscribed to the Google
@Rahul, We Are Working On It Will Try to Eliminate the people if found
they are doing same thing again
FYI:Google Docs is not Under Our Control, We Can't Implement our algorithm
to filter out interview related thread to other group, if it would have been
possible we just need to write small
@All Join Interview-Street Group For Detailed Discussion About Interview
Process of Particular Company , if You Have particular question wants to
discuss here , put that directly , All Interview Related Task Now Shifted
Interview-Street Group until Whole Thing is Done , You Can Search
The
i dnt knw why still these posts are allowed in algogeeks
On Fri, Oct 14, 2011 at 7:37 PM, WgpShashank shashank7andr...@gmail.comwrote:
@All Join Interview-Street Group For Detailed Discussion About Interview
Process of Particular Company , if You Have particular question wants to
discuss
in the first loop the value of k shuld vary from 0 to j-i.
On Oct 1, 7:26 am, rahul sharma rahul23111...@gmail.com wrote:
You are given two 32-bit numbers, N and M, and two bit positions, i and j.
Write a method to set all bits between i and j in N equal to M (e.g., M
becomes a substring of N
yeah u r ryt.
On Sun, Oct 2, 2011 at 4:20 PM, ravi ojha rbojha...@gmail.com wrote:
in the first loop the value of k shuld vary from 0 to j-i.
On Oct 1, 7:26 am, rahul sharma rahul23111...@gmail.com wrote:
You are given two 32-bit numbers, N and M, and two bit positions, i and
j.
can u tell in this we have to set i and j also or only between elements
say if i=2 and j=6
then
whether we should set bit no 2,3,4,5,6,
or 3,4,5
acc. to me its 2,3,4,5,6,
and ur logic also give that answer
plz tell??
On Sun, Oct 2, 2011 at 4:38 PM, rahul sharma
Can you please explain. I dont know about design patterns. Also please share
some good book for design patterns.
thanks
On Fri, Sep 23, 2011 at 4:07 PM, Prem Krishna Chettri hprem...@gmail.comwrote:
This is Simple query related to Factory Design Pattern... Have a look at
the Auto Registration
You have a library provided by the vendor. All you have is header files and
library files.
Library contains the class Shape and there is whole hierarchy tree (i mean
classes which derive from this base class).
Now you want to add some function getArea (not originally present in the
class or any of
This is Simple query related to Factory Design Pattern... Have a look at the
Auto Registration of Factory Design pattern..
:)
Prem
On Fri, Sep 23, 2011 at 3:02 PM, algo geek geeka...@gmail.com wrote:
You have a library provided by the vendor. All you have is header files and
library files.
can u explain the logic behind this
thanks in advance
--
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
*
*
*#include fstream
#include iostream
using namespace std;
bool flag=false;
void check(int i)
{
int sum=0;
char n[5];
itoa(i,n,10);
for(int j=0;j5 n[j] != '\0';j++)
{
char p = n[j];
sum += atoi(p);
}
if(sum==3 || sum==6 || sum==9)
flag = true;
else if(sum9)
check(sum);
}
void main()
{
int i;
Written test of adobe had 3 sections -
Quant and Analytical section - 45 questions(30 + 15) 45 mins
2 coding papers - 1 hr each , 10 ques each
1st coding paper had general MCQ (test ur c skills type )
2nd coding paper had ques for writing algos, codes and few OS
questions.
--
You received this
Thnx Amit...Can any one post some sample ques so that it vl be very useful
??
On Thu, Sep 8, 2011 at 11:41 AM, Amit Gupta amit070...@gmail.com wrote:
Written test of adobe had 3 sections -
Quant and Analytical section - 45 questions(30 + 15) 45 mins
2 coding papers - 1 hr each , 10 ques
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
@sumit, these numbers containing all ones are not in binary representation.
They are in decimal system.
On Sat, Aug 6, 2011 at 9:51 AM, sahil gujral gujralsa...@gmail.com wrote:
yes u r wrong..
1 is nt divisible by 23
On Sat, Aug 6, 2011 at 9:15 AM, sumit sumitispar...@gmail.com
please anyone of you post more question asked by adobe this yr...
please
On Sat, Aug 6, 2011 at 12:24 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:
@sumit, these numbers containing all ones are not in binary representation.
They are in decimal system.
On Sat, Aug 6, 2011 at 9:51 AM,
http://trickofmind.com/?p=1080
i think this will help, we need to find Carmichael number or somthing
related to ETF for the input number.
On Sat, Aug 6, 2011 at 12:24 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:
@sumit, these numbers containing all ones are not in binary representation.
Mukul, in first approach instead of sending the string again and again u
can use the formula
(a*b)%m = ((a%m)*(b%m))%m
this way u can do sumthin like dis
int count = 0, a = 1;
while(a != 0) {
count++;
a = ((a*10)%n + 1) %n;
}
n later output a string consisting of count one's..
Regards
VM
3rd
c round-
output que
given an expression - take it any ( 5+((4^5)+(6/7))+(4/8) )- aim was
to ensure that brackets are correctly placed
ds/algo-
1)java virtual machine has 8 byte instruction..calc its instruction
code size
2)there was a code given using lock ,wait and thread..had to tell abt
Vaibhav,
Hmm, fine that. I am more interested in the 2nd approach. The first approach
is simple brute force.
On Sat, Aug 6, 2011 at 3:11 PM, vaibhavmitta...@gmail.com wrote:
Mukul, in first approach instead of sending the string again and again u
can use the formula
(a*b)%m = ((a%m)*(b%m))%m
mukul, pls explain my following doubts:
1. whats the need of subtracting the numbers, like u subtracted 91 then 52
etc...
2. the ones digit 7 is ok... didnt get how did u reach 4??
On Sat, Aug 6, 2011 at 3:22 PM, Mukul Gupta mukul.gupta...@gmail.comwrote:
Vaibhav,
Hmm, fine that. I am more
thanx mukul for explanation checked it randomly on 123.. it works
fine...
On Sat, Aug 6, 2011 at 11:27 PM, Ashish Sachdeva ashish.asachd...@gmail.com
wrote:
mukul, pls explain my following doubts:
1. whats the need of subtracting the numbers, like u subtracted 91 then 52
etc...
2. the
ADOBE asks the very basic C/C++ questions
one of their toughest however was :
every number ending in 3 has a multiple of the form 111...111
e.g 3 has 111
13 has 11
so on..
find the algo for finding the number for an input number ending in 3.
On Aug 5, 2:33 pm, Agyat
This looks quite simple.
Every number ending in 3 follows a pattern.eg-
3 - 111
13 - 11
23 - 1 etc
we can find the reauired no. by :
suppose input no. is 33
In every case leave the no at 1's place(least significant) i.e. 3, In
33 you will be left with 3(after removal of 3 at first
yes u r wrong..
1 is nt divisible by 23
On Sat, Aug 6, 2011 at 9:15 AM, sumit sumitispar...@gmail.com wrote:
This looks quite simple.
Every number ending in 3 follows a pattern.eg-
3 - 111
13 - 11
23 - 1 etc
we can find the reauired no. by :
suppose input no. is 33
In
@ankit: not the last digit..!!
it will be (last digit -3) or (last digit -3-3) whichever is positive..
:)
On 7/31/11, Ankit Minglani ankit.mingl...@gmail.com wrote:
yeah if it was a divisibility test then the question would have been too
trivial ..
the last digit after doing itoa will be the
Hi,
we can show that
(x/3) = (x/2) - (x/4) + (x/8) - (x/16) + infinity
Proof:
let s1 = (x/2)+(x/8)+(x/32)+...infinity = (x/2)/(1-(1/4)) [Geometric
Progression , common Ratio(r) = 1/4]
s2 = (x/4)+(x/16)+(x/64)+...infinity = (x/4)/(1-(1/4)) [Geometric
Progression , common Ratio(r) =
yeah if it was a divisibility test then the question would have been too
trivial ..
the last digit after doing itoa will be the remainder .
On Sat, Jul 30, 2011 at 11:52 AM, nivedita arora
vivaciousnived...@gmail.com wrote:
i think solution of ankit is right !
sorry even i forgot tht que ws
Single bit shift...
int divide(int n)
{
n-=1;
n=1;
return n;
}
On 7/30/11, tech rascal techrascal...@gmail.com wrote:
hw will u get the ans on repeated subtraction from the sum of the digits??
I mean if I hv 2 divide 27 by 3 thn first I'll find sum of the digits
i.e, 2+7=9
then I'll
@Samm : Im not able to understand ur logic...im not getting the correct
ans...can u explain the working taking n as 7?
On Sat, Jul 30, 2011 at 12:25 PM, SAMM somnath.nit...@gmail.com wrote:
Single bit shift...
int divide(int n)
{
n-=1;
n=1;
return n;
}
On 7/30/11, tech rascal
#includestdio.h
#includestdlib.h
#includeconio.h
#includestring.h
#includemath.h
int multiply(int a,int b)
{
int i;
int temp=a;
printf(\na=%d b=%d\n,a,b);
for(i=1;ib;i++)
a+=temp;
printf(\nfinal a = %d,a);
return(a);
}
void main ()
{
int x,rem,quo=0,i,j;
I think the whole point and advantage of using itoa is to make the
code suitable for larger integer inputs..
eg: if i/p is: 32765 , itoa gives 32765, we take each sum=3+2+7+6+5=
23 and then use repeated subtraction...
Repeated subtraction on 2 digit no. is much faster than on 5 digit one..!!
let the number be num
so code is this
int ans=0;
while(num=3)
{
num=num-3;
ans++;
}
No need to use itoa. This is simple division algo based on subtraction.
On Sat, Jul 30, 2011 at 2:09 PM, Ankit Minglani ankit.mingl...@gmail.comwrote:
#includestdio.h
#includestdlib.h
The objective is to divide the number by 3 and not just check for it's
divisibility.
Adding the digits using itoa() and then repeated subtraction will check for
it's divisibility by 3 and not give us the quotient.
To get that you will have to carry out repeated subtraction on the number
anyway.
@roopam : i got the question all wrong. . .
On Sat, Jul 30, 2011 at 10:01 PM, Roopam Poddar mailroo...@gmail.comwrote:
The objective is to divide the number by 3 and not just check for it's
divisibility.
Adding the digits using itoa() and then repeated subtraction will check for
it's
@roopam: Thats what i am saying... the function itoa only gives you
the remainder, it doesnt provide quotient..we need to do repeated
subtraction for that...
On 7/30/11, Ankur Khurana ankur.kkhur...@gmail.com wrote:
@roopam : i got the question all wrong. . .
On Sat, Jul 30, 2011 at 10:01
i think solution of ankit is right !
sorry even i forgot tht que ws not divisibility test ..but to get
quotient :-|
On Jul 30, 10:03 pm, Ankur Khurana ankur.kkhur...@gmail.com wrote:
@roopam : i got the question all wrong. . .
On Sat, Jul 30, 2011 at 10:01 PM, Roopam Poddar
hmm ok got it . ..i can take gt sum of digits without having the
number as string as well . i din exactly gt the whole point of using
strings.
they shud hv mentioned it explicitly i guess . .
though thanks ankur
On Jul 30, 1:15 am, Ankur Khurana ankur.kkhur...@gmail.com wrote:
you shouldn't be
well,well,well...
a=x1;
b=x2;
c=(a+b)1;
d=x3;
x=c+d;
actually i used the fact- 1/3 = 3/9 = ((1/2)+(1/4))/2 + 1/8
On Jul 30, 1:37 am, nivedita arora vivaciousnived...@gmail.com
wrote:
hmm ok got it . ..i can take gt sum of digits without having the
number as string as well . i din exactly gt
ur expression forms 4/8=1/2 and not 1/3...
On Sat, Jul 30, 2011 at 3:18 AM, Amit amitbaranwa...@gmail.com wrote:
well,well,well...
a=x1;
b=x2;
c=(a+b)1;
d=x3;
x=c+d;
actually i used the fact- 1/3 = 3/9 = ((1/2)+(1/4))/2 + 1/8
On Jul 30, 1:37 am, nivedita arora
int divideby3 (int num)
{
int sum = 0;
while (num 3) {
sum += num 2;
num = (num 2) + (num 3);
}
if (num == 3) ++sum;
return sum;
}
Thanks Regards...*
รυ∂んเя мเรんяค*
--
You received this message because you are subscribed to the Google Groups
Algorithm
@ankur I didnt get this... could u or anyone please elaborate!
On Jul 30, 12:43 am, Ankur Khurana ankur.kkhur...@gmail.com wrote:
when you use itoa , what you get is a string. get the sum of all the digits
, using c-'0' and then use repeated subtraction . . .
On Sat, Jul 30, 2011 at 1:01 AM,
shift the number to left two times and subtract once... I.e.
Int x=num;
x=x2;
x-=num;
On 7/30/11, brijesh brijeshupadhyay...@gmail.com wrote:
@ankur I didnt get this... could u or anyone please elaborate!
On Jul 30, 12:43 am, Ankur Khurana ankur.kkhur...@gmail.com wrote:
when you use itoa ,
@brijesh-
itoa basically converts integer to string ..we are using the fact tht
a number is multiple of 3 if its sum is multiple of 3
. we have int as string and we can traverse it ..for each character
apply
int sum+=*c-'0' (ankur missed the star :P)
then on sum we use repeated subtraction...i
hw will u get the ans on repeated subtraction from the sum of the digits??
I mean if I hv 2 divide 27 by 3 thn first I'll find sum of the digits
i.e, 2+7=9
then I'll apply repeated subtraction on 9, so hw will i reach to the ans??
On Sat, Jul 30, 2011 at 10:05 AM, nivedita arora
I gave an O(N) solution in a different thread by same author for this
question...
On Thu, Jul 21, 2011 at 6:08 PM, Abhi abhi123khat...@gmail.com wrote:
My solution for this :
#includestdio.h
int max(int a,int b)
{
return ab?a:b;
}
int main()
{
char str[] = abcdab;
int
Sorry , solution nahi dekha tha tera maine.
On Thu, Jul 21, 2011 at 9:29 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:
I gave an O(N) solution in a different thread by same author for this
question...
On Thu, Jul 21, 2011 at 6:08 PM, Abhi abhi123khat...@gmail.com wrote:
My
but mine was different , check kar liyo
On Thu, Jul 21, 2011 at 10:06 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:
Sorry , solution nahi dekha tha tera maine.
On Thu, Jul 21, 2011 at 9:29 PM, Ankur Khurana
ankur.kkhur...@gmail.comwrote:
I gave an O(N) solution in a different
http://anandtechblog.blogspot.com/2011/06/in-place-shuffle.html
On Mon, Jan 10, 2011 at 9:06 AM, anurag.singh anurag.x.si...@gmail.comwrote:
OK. I hope following should do the needful.
Input:
a1,a2,a3,a4,.aN,b1,b2,b3,b4,.,bN
Output:
a1,b1,a2,b2,a3,b3,a4,b4,..aN,bN.
If we
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
1 - 100 of 219 matches
Mail list logo