Given 777777, it can be divided into 77-77-77 or 777-777
so it will return 77-77-77 with a quality of 6, other than the other
way, which gives quality of 4.
Also , a good group like 229, can be seen as 22-9, which gives a
excellent group.

I assume first looking groups with 2 digits?

On Jul 7, 2:16 pm, Piyush Sinha <ecstasy.piy...@gmail.com> wrote:
> You are given a String number containing the digits of a phone number
> (the number of digits, n, can be any positive integer) . To help you
> memorize the number, you want to divide it into groups of contiguous
> digits. Each group must contain exactly 2 or 3 digits. There are three
> kinds of groups:
> • Excellent: A group that contains only the same digits. For example, 000 or 
> 77.
> • Good: A group of 3 digits, 2 of which are the same. For example,
> 030, 229 or 166.
> • Usual: A group in which all the digits are distinct. For example, 123 or 90.
> The quality of a group assignment is defined as 2 × (number of
> excellent groups) + (number of good groups)
> Divide the number into groups such that the quality is maximized.
> Design an efficient
> algorithm to return the solution that maximizes the quality.
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=100000655377926*

-- 
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