Re: [algogeeks] SPOJ problem : CANDY III

2012-06-21 Thread romil bansal
Initialize sum as zero for all test cases ie inside 1st for loop. On Jun 21, 2012 5:22 PM, Mayank Singh singh13490may...@gmail.com wrote: here is my code : #includestdio.h #includestdlib.h int main() { long long cand,sum; int T,N,i,j,*temp; scanf(%d,T); temp=

Re: [algogeeks] Re: Microsoft question

2012-06-21 Thread romil bansal
Can't we use k iterations of bubble sort ? On Jun 18, 2012 2:11 PM, Ramindar Singh ramin...@gmail.com wrote: We can use Median of medians http://en.wikipedia.org/wiki/Selection_algorithm#Linear_general_selection_algorithm_-_Median_of_Medians_algorithm On Sunday, 17 June 2012 08:13:18

Re: [algogeeks] Re: DE Shaw Q

2011-06-15 Thread romil bansal
i think it can be done by counting the no of starting heaps with 1 coins in it before any heap with coin1 in it. if all the heaps have only one coin that player1 win if heap%2==1 if there is any heap with 1 then player1 win if (starting heap with 1 coin in them)%2==0. eg player 1 win in case 1 of