Re: [algogeeks] [brain teaser] Sequence Puzzle 13april

2011-04-13 Thread Akash Agrawal
next row: 3 1 2 2 1 1 just read the previous row: THREE 1 TWO 2 ONE 1 Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Wed, Apr 13, 2011 at 3:27 PM, vaibhav shukla vaibhav200...@gmail.comwrote: On Wed, Apr 13, 2011 at 1:02 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote

Re: [algogeeks] Re: [brain teaser] Sequence Puzzle 13april

2011-04-13 Thread Akash Agrawal
a bit more clearly ?? On Apr 13, 3:27 pm, Akash Agrawal akash.agrawa...@gmail.com wrote: next row: 3 1 2 2 1 1 just read the previous row: THREE 1 TWO 2 ONE 1 Regards, Akash Agrawalhttp://tech-queries.blogspot.com/ On Wed, Apr 13, 2011 at 3:27 PM, vaibhav shukla vaibhav200...@gmail.comwrote

[algogeeks] Sort array with two subparts sorted

2011-04-12 Thread Akash Agrawal
Given an array with two subparts sorted. How will you make a final sorted array. i/p: 1, 5, 7, 9, 11, 23, 2, 3, 8, 9, 21 o/p: 1, 2, 3, 5, 7, 8, 9, 9, 11, 21, 23 Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- You received this message because you are subscribed to the Google

Re: [algogeeks] Sort array with two subparts sorted

2011-04-12 Thread Akash Agrawal
This is obvious solution what if u have contant space? Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Apr 12, 2011 at 3:48 PM, rajul jain rajuljain...@gmail.com wrote: use merge sort On Tue, Apr 12, 2011 at 3:07 PM, Akash Agrawal akash.agrawa...@gmail.comwrote: Given

Re: [algogeeks] Re: Sort array with two subparts sorted

2011-04-12 Thread Akash Agrawal
, 9, 21 1, 2, 3, 5, 11, 9, 7, 8, 9, 21 1, 2, 3, 5, 7, 9, 11, 8, 9, 21 1, 2, 3, 5, 7, 8, 11, 9, 9, 21 1, 2, 3, 5, 7, 8, 9, 11, 9, 21 1, 2, 3, 5, 7, 8, 9, 9, 11, 21 Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Apr 12, 2011 at 10:23 PM, powerideas arpitbhatnagarm

Re: [algogeeks] [brain teaser ] 6april

2011-04-06 Thread Akash Agrawal
throw opposite to gravity... Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Wed, Apr 6, 2011 at 1:26 PM, balaji a peshwa.bal...@gmail.com wrote: when u throw it above u. On Wed, Apr 6, 2011 at 1:16 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: * The Ball Puzzle *How can

Re: [algogeeks] [brain teaser ] 5april

2011-04-05 Thread Akash Agrawal
14 Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Apr 5, 2011 at 1:17 PM, DeboJeet Choudhury wildrahul.on...@gmail.com wrote: 34 roses @ the begining... On Tue, Apr 5, 2011 at 1:11 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Roses Puzzle Solution* * *I have

Re: [algogeeks] [brain teaser ] 28march

2011-03-28 Thread Akash Agrawal
7 races... Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Mon, Mar 28, 2011 at 3:50 PM, anand karthik anandkarthik@gmail.comwrote: Evertime you conduct a race, you eliminate 2 horses. So, 11. On Mar 28, 2011 1:24 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: *Horse Race

Re: [algogeeks] Re: Find the first K smallest element from 1 million sized array ...Amazon Question..

2011-03-24 Thread Akash Agrawal
http://tech-queries.blogspot.com/2009/05/find-largest-20-elements-from-billions.html Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Mar 22, 2011 at 10:13 AM, Rajeev Kumar rajeevprasa...@gmail.comwrote: http://flexaired.blogspot.com/2011/03/big-file-containing-billions

Re: [algogeeks] [brain teaser ] 14march

2011-03-14 Thread Akash Agrawal
shadow... Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Mon, Mar 14, 2011 at 1:57 PM, Praveen praveen200...@gmail.com wrote: Wood On Mon, Mar 14, 2011 at 1:45 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: * Riddle Problem Solution* ** * *The part of the bird

Re: [algogeeks] Re: Maximize the Time to see TV

2011-03-04 Thread Akash Agrawal
U can always have a trackback array as we do in LIS. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Fri, Mar 4, 2011 at 5:48 PM, Vipin Agrawal vipin.iitr@gmail.comwrote: Solution is good, but its says only Max time that he can spend. How would he know that which program he

Re: [algogeeks] Re: DP Problem: minimum Cost

2010-12-31 Thread Akash Agrawal
]) { ans[i] = cos; // cout ans[i]iendl; } } } if (i=140 ans[i] INT_MAX) break; } cout ans[i] i endl; return 0; } Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Thu, Dec 30, 2010 at 6:03 PM, juver++ avpostni...@gmail.com wrote: DP[K][N] - minimal cost choosing N

Re: [algogeeks] Re: Strings search problem

2010-12-31 Thread Akash Agrawal
http://tech-queries.blogspot.com/2010/12/finding-minimum-window-in-array-which.html just use words in place of chars... Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Fri, Dec 31, 2010 at 11:00 AM, Davin dkthar...@googlemail.com wrote: Find the area with less distance between

[algogeeks] DP Problem: minimum Cost

2010-12-30 Thread Akash Agrawal
packets of 70 balls each to minimize cost. Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- 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

Re: [algogeeks] Re: Pythagorean triples

2010-12-27 Thread Akash Agrawal
http://tech-queries.blogspot.com/2010/12/find-pythagorean-triples-in-unsorted.html Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Mon, Dec 20, 2010 at 8:12 PM, Dave dave_and_da...@juno.com wrote: Unless sorting the array is forbidden, sort it and then use the obvious O(n^2

Re: [algogeeks] Re: Amazon Question

2010-12-19 Thread Akash Agrawal
2D matrix sum is a simple DP problem, but U need n*n extra space as well or have to change the i/p. (u can get the i/p back once if required) If this is acceptable, let me explain. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Sun, Dec 19, 2010 at 7:01 PM, juver++ avpostni

Re: [algogeeks] DP problem

2010-12-17 Thread Akash Agrawal
Hey Amir, Can u please throw some more light on this. I am not able to find a good solution for subset sum problem as well. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Fri, Dec 17, 2010 at 7:29 PM, Amir hossein Shahriari amir.hossein.shahri...@gmail.com wrote: sort jewelries

[algogeeks] DP problem

2010-12-13 Thread Akash Agrawal
) 5 (first 5) 1,2,3,4 5,5Note that each '5' is a different piece of jewelry and needs to be accounted for separately. There are 9 legal ways of allocating the jewelry to Bob andFrank given the policy, so your method would return 9. Regards, Akash Agrawal http://tech-queries.blogspot.com

Re: [algogeeks] file handling

2010-12-13 Thread Akash Agrawal
use FILE * Can u elaborate on the probelm? Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Mon, Dec 13, 2010 at 1:03 PM, neeraj agarwal itsneerajagar...@gmail.comwrote: i am facing problem in file handling in C can any one suggest me how to implement them. -- You received

Re: [algogeeks] Google questions

2010-12-13 Thread Akash Agrawal
It is like finding the in order successor. See it here (using parent pointer) http://tech-queries.blogspot.com/2010/04/inorder-succesor-in-binary-tree.html w/0 Parent pointer: http://tech-queries.blogspot.com/2010/04/inorder-succesor-in-binary-tree-wo.html Regards, Akash Agrawal http://tech

[algogeeks] matrix sum

2010-12-13 Thread Akash Agrawal
You have given a matrix of n*m integer. A query will come to you with two co-ordinate (x1,y1) (x2,y2). You need to find sum of all elements which falls inside rectangle. As you will be bombarded with such query, you solution should be very very quick. Ans should be in O(1) Regards, Akash

Re: [algogeeks] find triplets in an integer array A[] which satisfy condition: a[i]^2 + a[j]^2 = a[k]^2

2010-12-13 Thread Akash Agrawal
Thanks everyone; that O(n^2) is an awesome solution. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Thu, Dec 2, 2010 at 12:21 PM, fenghuang fenghaungyuyi...@gmail.comwrote: @anoop when you find some i and j(i j) meet the condition i.e. asq[i] + asq[j] == asq[k], you can merge