Re: [algogeeks] Re: Nice question

2011-12-13 Thread Gaurav Kumar
When the difference is 0, the numbers will be repeated: 000, 111, 222, 333, 444, 555, 666, 777, 888, 999 but only these are possible. Gaurav On Tue, Dec 13, 2011 at 10:47 AM, Don dondod...@gmail.com wrote: Moheed, If n=3 and absdiff = {0,0}, your program says that there are 100 possible

Re: [algogeeks] Re: Nice question

2011-12-13 Thread Gaurav Kumar
are (10 - 0) x 2 / 2 x 1 way x 1 way = 10 ways Gaurav On Tue, Dec 13, 2011 at 10:55 AM, Gaurav Kumar gkuma...@gmail.com wrote: When the difference is 0, the numbers will be repeated: 000, 111, 222, 333, 444, 555, 666, 777, 888, 999 but only these are possible. Gaurav On Tue, Dec 13, 2011

Re: [algogeeks] Suggest Algo for this Question

2011-12-13 Thread Gaurav Kumar
Why can't we keep removing the minimum element each time and compare it with x? This should take O(k) time since in a Min heap, the minimum element can be removed in O(1) time? Am I missing something? On Tue, Dec 13, 2011 at 8:43 AM, atul anand atul.87fri...@gmail.com wrote: O(k) in the

Re: [algogeeks] Re: Nice question

2011-12-13 Thread Gaurav Kumar
other than 7, keep working on it. Don On Dec 13, 1:46 pm, Gaurav Kumar gkuma...@gmail.com wrote: 3 2 5 1 so the total number of numbers possible are (10-3) x 2 x (10- 2) x 2 x (10 -5 ) x 2 x (10 - 1 ) x 2 In case when you have 0 0 0 as the difference, possible combinations are (10

Re: [algogeeks] Re: Nice question

2011-12-13 Thread Gaurav Kumar
Thanks for pointing out the issue with my logic. What I am wondering is what is the general solution to finding the number of possible numbers? Is the only way is to try these combinations? Please share if you know. Gaurav On Tue, Dec 13, 2011 at 1:56 PM, Gaurav Kumar gkuma...@gmail.com wrote

Re: [algogeeks] Sub-array problem

2011-12-12 Thread Gaurav Kumar
checks will work it would be easier to understand the issues that currently i feel are there.. On Dec 11, 1:41 am, Gaurav Kumar gkuma...@gmail.com wrote: Here is the code for O (nlgn) time complexity using recursion written in Java: public class SubArray { static int A [] = {2, 1, 3

Re: [algogeeks] Sub-array problem

2011-12-10 Thread Gaurav Kumar
Here is the code for O (nlgn) time complexity using recursion written in Java: public class SubArray { static int A [] = {2, 1, 3, 4, 5}; static int k; private class Result { int lo; int hi; int total;

Re: [algogeeks] Number Theory (Power of 3 )

2011-12-09 Thread Gaurav Kumar
What if we create a base 3 number from the given number N and then check if there is only 1 bit with value 1 and all values should be 0. For example, if lets say the number is 27. Its base 3 number will be 1 0 0 0, now since there is only 1 single 1 present in this representation, it is a power

Re: [algogeeks] Sub-array problem

2011-12-09 Thread Gaurav Kumar
I think we can also solve this using divide and conquer: The algorithm is based on the concept of diving the current array into two parts and then considering if the solution exists, in the first part from lo to mid and last part from mid+1 to high and the case in which the subarray crosses

Re: [algogeeks] Stone Game

2011-10-13 Thread Gaurav Kumar
I don't see this code considers the case when after throwing i stones, the pile is still left with (Si-i) stones. For example, let say pile 10 had 25 stones, now even after throwing 10 stones, pile 25 would be left with 15 stones, which could again be thrown by the next person. Am I missing

Re: [algogeeks] Stone Game

2011-10-13 Thread Gaurav Kumar
Note that the problem says that the pile has AT LEAST i stones not exactly i stones. So it can for sure have more than i. On Thu, Oct 13, 2011 at 4:50 PM, Gaurav Kumar gkuma...@gmail.com wrote: I don't see this code considers the case when after throwing i stones, the pile is still left

Re: [algogeeks] adobe question help

2011-10-11 Thread Gaurav Kumar
This is a question from Laakman. This code operates by clearing all bits in N between position i and j, and then ORing to put M in there 1 public static int updateBits(int n, int m, int i, int j) { 2 int max = ~0; /* All 1's */ 3 4 // 1's through position j, then 0's 5 int left = max

[algogeeks] MS WRITTEN TEST FOR INTERNS

2011-10-02 Thread gaurav kumar
there were 10 objective questions covering c,c++ and ds questions were on mainly memory allocation stack and heap ,etc output/error ; subjective part 1. compress the given string eg. aaabbcccaadee o/p = a3b2c3de2 2. u have to give the various test case and fault cases for a USB device such

[algogeeks] amazon writtwen test

2011-10-02 Thread gaurav kumar
25 objective questions focused on operatig system basic commands of linux aptitude - 4-5 questions rest on algos, ds, c nd c++ 3 subjective questions 1) merge two sorted link list 2) u have given coins of vrious denominations and u have to make a sum with min. no. of coins 3) an amazon own alogo

[algogeeks] Re: MS WRITTEN TEST FOR INTERNS

2011-10-02 Thread gaurav kumar
pec, unversity of technology chandigarh On Oct 2, 10:46 pm, rahul sharma rahul23111...@gmail.com wrote: hey from which college r u??? On Sun, Oct 2, 2011 at 10:51 PM, gaurav kumar mailmea...@gmail.com wrote: there were 10 objective questions covering c,c++ and ds questions were

[algogeeks] Re: constructor ques

2011-08-23 Thread gaurav kumar
+1 coder On Aug 23, 1:31 am, JAIDEV YADAV jaid...@gmail.com wrote: yeah D first ... On Mon, Aug 22, 2011 at 10:53 PM, sagar pareek sagarpar...@gmail.comwrote: +1 coder On Mon, Aug 22, 2011 at 9:41 PM, sukran dhawan sukrandha...@gmail.comwrote: hey sorry didnt notice virtual

[algogeeks] Re: GS apti ques!

2011-08-17 Thread gaurav kumar
any more questions plzz..gs is coming to ur colg on 23rd ...technical also ? Even i got 0.212 *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 17, 2011 at 4:42 PM, Romil ... vamosro...@gmail.comwrote: Kumar's approach would not do perhaps. I simply eliminated the

[algogeeks] Re: GS apti ques!

2011-08-17 Thread gaurav kumar
@priya ... which is your colg ? On Aug 17, 10:01 pm, gaurav kumar mailmea...@gmail.com wrote: any more questions plzz..gs is coming to ur colg on 23rd ...technical also ? Even i got 0.212 *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 17, 2011 at 4:42 PM

[algogeeks] Goldman sachs _ DCE _ 10 AUGUST

2011-08-12 Thread gaurav kumar
All DCE students are requested to upload the interview / written questions which were asked by goldman sachs on 10 aug 2011 for internship 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] Re: microsoft paper that i wrote today..

2011-08-12 Thread gaurav kumar
thanks a lot mate . On Aug 11, 4:51 pm, sindhu sindhu...@gmail.com wrote: 1. write a method to find the smallest angle between two hands when the time is given as input??? 2. given a number between 1 to 1000 convert it to words..example 235..it should print as two hundred thirty five.. 3.

[algogeeks] Re: GS on campus

2011-08-06 Thread gaurav kumar
@nitish i agree to your point of college policy. But think of the support/help which we can get through u guys in advance for a particular company. even u people of dce also need this . I request u to post as much questions of interview/written on this platform. it is really helpful. On Aug 7,