[algogeeks] Manufacturing equal length poles from given Rods

2017-12-10 Thread pankaj joshi
Hello geeks, I came across a problem, please help me to find out solution of it. Statement: There are N iron rods having some hight, task is to manufacture two poles having same hight using the available N rods. ( these poles are used for hoarding), it’s expected that hoarding can be seen from ver

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread pankaj joshi
algo for :- > > 1,2,5,10,100,30,8,555 > > let me know if it work fine.If it is working fine then i need more > clarity of your algo > > On 10/24/13, pankaj joshi wrote: > > @Saurabh: > > As per the question the elements of sub-sequence should be increasing, > > so

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread pankaj joshi
in the > array...so it wont work. > > On 10/24/13, Saurabh Paliwal wrote: > > check for {5,2,3} and K = 2. > > > > > > > > On Thu, Oct 24, 2013 at 7:41 PM, pankaj joshi > wrote: > > > >> @ Saurabh, > >> > >> I have

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread pankaj joshi
hu, Oct 24, 2013 at 5:48 PM, pankaj joshi wrote: > >> >> hi all, >> >> nlog(k) is the solution i think. >> can anyone suggest more optimal? >> solution: >> create a min-heap, (condition size should be always k) >> >> temp =0 >> loop

Re: [algogeeks] variation of LIS problem

2013-10-24 Thread pankaj joshi
hi all, nlog(k) is the solution i think. can anyone suggest more optimal? solution: create a min-heap, (condition size should be always k) temp =0 loop n to a[] if a[i]>temp if min-heap(root) < a[i] delete root in min- heap inseart a[i] in min - heap at the end of main loop the min

[algogeeks] Need an optimized solution.

2013-10-17 Thread pankaj joshi
HI All, Puzzle: (This puzzle is of hacker rank) Harvey gives two numbers N and K and defines a set A. *A = { x : x is a natural number ≤ N }* (i.e), A = {1,2,3,4,5,6,…., N} Mike has to find the total number of pairs of elements A[i] and A[j] belongi

Re: [algogeeks] Re: Array of intergers with repeating elements

2013-05-10 Thread pankaj joshi
Hi, we can calculate the frequency of all element, Assign sort them in increasing order of frequency. then the first element of sorted list will be the return element. 0 wrote: > sry link was not pasted > > http://stackoverflow.com/questions/7338070/finding-an-element-in-an-array-where-every-ele

Re: [algogeeks] Re: Amazon interview question

2013-04-13 Thread pankaj joshi
in this Problem if the array is A[n] = {a0,a1,a(n-1),a(n)} after the second iteration, the value will be {a0 -2*a2+a3, a2 -2*a3 + a4, a3-2*a4+a5,, a(n-2)-2a(n-1)+a(n)} if we add all these terms then all the middle elements will be canceled out so the remaining will be. {a0-a2 - a(n-