Re: [algogeeks] Amazon interview Question

2013-02-07 Thread srikar
not the other way unless there are some special constraints. Hashtable it is. Srikar On Thursday, February 7, 2013 12:35:21 PM UTC+5:30, bharat wrote: @srikar : approach2 is wrong. ex: [1, 5, 7, 66, 7, 1, 77] first window [1,5,7] all are unique.oops On Wed, Feb 6, 2013 at 11

Re: [algogeeks] Amazon interview Question

2013-02-06 Thread Srikar
. Hence 7 is the first unique element. space: O(1) time: O(n) For seond Q I still think hashtable is best. As the numbers are streamed, keep inserting. Srikar On Wed, Feb 6, 2013 at 10:00 AM, navneet singh gaur navneet.singhg...@gmail.com wrote: nice algo ankit, so it will be nlogn using O

Re: [algogeeks] Re: top search queries

2011-02-03 Thread Srikar
@algoose I see what you are saying. what do you propose? checking out your link now... On Thu, Feb 3, 2011 at 11:44 AM, Algoose chase harishp...@gmail.com wrote: @Srikar In your first approach you cant simply ignore the queries that are not present in the heap because you have a stream

Re: [algogeeks] Re: minimum no. of clicks

2011-02-02 Thread Srikar
wrote: @Srikar: Isn't it sort of silly to propose an O(n log n) algorithm when just naively clicking on the digits in order gives an O(n) algorithm? Dave On Feb 1, 12:04 pm, Srikar srikar2...@gmail.com wrote: Could I sort it? Oh you mentioned that the original array could be destroyed

Re: [algogeeks] Excel Sheet Question Asked

2011-02-01 Thread Srikar
since the problem uses all 26 letters, we could use a number system with base as 26. 2 operations are - 1) Given number to string - Treat the number as number in base 26. 2) Given string to number. Credit goes here -

Re: [algogeeks] minimum no. of clicks

2011-02-01 Thread Srikar
Could I sort it? Oh you mentioned that the original array could be destroyed. In that case, 1) Sort the array - O(nlogn) 2) loop through the array. if contiguous elements are same remove all of them in one click else remove only that element. - O(n) Time - O(nlogn) space - O(1) On Tue, Feb

Re: [algogeeks] top search queries

2011-01-31 Thread Srikar
of the node at min-heap is the current query freq. if (curr_query_freq min-heap node freq.) then swap the min-heap node reorder the heap. else continue. Time: O(logn) n=number of queries we want to consider. space: O(n) Srikar On Mon, Jan 31, 2011 at 6:57 PM, snehal jain learner@gmail.com