Hi, My approach:-
3 1 2 1 4 1 2 1 4 3 2 1) Find matching element from start and end. here it willl be 3 2) Perfrom (#1) for sub array 1 2 1 4 1 2 1 4 here it will be 2 1 4 1 2 4 left out 3) Perfrom (#1) on 2 1 4 1 2 here it will be 1 4 1 4) Perform (#1) on 1 4 1 here it will be 4 5) 4 is single element. discard it. @1 Now going to discard earlier found pairs..FROM INSIDE GOING OUT 6) 11 -> discard @ 2 7) 22 -> discard @ 3 8) 11 -> discard @ 4 9) 4 -> discard @5 10) 33 -> discard @ 6 11) 2 -> discard @ 7 Special coding.. :- 1) Consider 1 2 1 3 1 11 -> subarrray 2 1 3 sent match not found. remember... last matching element.. which is 1. delete remainging single elements. in this case...from 2 1 3 ... 2 and 3 will be deleted.. 1 1 1 will be deleted.. 3 clicks for 5 elements... On Feb 3, 1:42 am, sourabh jakhar <sourabhjak...@gmail.com> wrote: > this solution is wrong > > > > > > > > > > On Wed, Feb 2, 2011 at 12:41 AM, 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<algogeeks%2Bunsubscribe@googlegroups > > .com> > > . > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. > > -- > SOURABH JAKHAR,(CSE)(3 year) > ROOM NO 167 , > TILAK,HOSTEL > 'MNNIT ALLAHABAD > > The Law of Win says, "Let's not do it your way or my way; let's do it the > best way." -- 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.