@Bittu: You said to correct you if you are wrong, so here goes. The
original problem statement says that you can remove any continuous
chunk of the same numbers with one click. Maybe it would have been
clearer to use the word "contiguous" instead of "continuous," but
since your 4s are not adjacent to each other, it will take two clicks
to remove them. And so on.

Dave

On Feb 1, 1:11 pm, bittu <shashank7andr...@gmail.com> wrote:
> @ its again the question related to the frequency..of number
>
> My Approach would be
> we have to count the no. of time the a particular number occurring in
> the array  then first took the number which has lowest frequency in
> case of Tie FCFS used up.
> then proceed to higher frequency number that represents the continuous
> chunks so that how much elements this chunks it has we can remove this
> in a single click & so on....
>
> so for this 3 1 2 1 4 3 1 2 1 4 3 2
>
> here array of  4 elements
> Elements    1 2 3 4   ///also lets say we are initializing the array
> index as 1
> Index          1 2 3 4
> Frequency   4 3 3 2
>
> we first process the 4      Click Required 1
> then  2                           Click Required 1
> then 3                            Click Required 1
> then 1                            Click Required 1
>
> Total  Click Required =4
>
> so It Can be done in O(n) while space O(n) is penalty we have to pay
> for it...more better approach will be appreciated
>
> Correct me if you Find Approach is wrongs
>
> Thanks & Regrads
> Shashank Mani ""The best way to escape from a problem is to solve it."

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to