Challenge (6/19/2020)

We post one challenging problem here every week. Solution due is 11:59 PM every Friday. We offer awards to two responders. 1. The first one with the right solution. 2. The correct solution with fewest code statements.

If we get only one correct solution, we will skip the award for the fewest code statements.

You need to create an account in this club in order to participate in this competition. The solution can use one of these three languages: Java, Python, JavaScript. You can submit your solution to this topic. Make sure your name and email account are in the end of the solution.

If you want that we indent your code correctly, please submit your code to this challenge along with a screenshot of your code in your IDE or your code file as an attachment. Remember you still need to submit your code as text here. Thanks for your participation.

Problem: When you play pool game, you use one ball to hit a group ball and then that group ball is scattered over the pool table. Think about this game using letters. Ask the user to input a variant length string of letters (length is no more than 30 but must be lower case letters). Find the letter that occurs the most times in the string (if more than one letter, using the one that appears before the other one) and use it as the hit ball. You use the hit ball to split the string. Find out how many small groups you have. Also find out the smallest group and the biggest group (Both in number of letters. If multiple, using the one with smaller sum of Unicode values for the smallest and the one with bigger sum of Unicode values for the biggest) . Get the difference of the number of letter in the biggest and the smallest group. Divide this number by the number of the total groups. Print the result out.

9 thoughts on “Challenge (6/19/2020)”

      1. You almost got there but the final step was wrong. It shall be divided by 4 because you have 4 groups.

        Here is the output.

        E:\Python\python.exe C:/Users/yangx/PycharmProjects/AOE/com/aoe/stem/codeflow1.py
        Please input a string that has less than 30 characters and is all lowercase letters.hgdtjkltasfmtuvwz
        The lettered that occurred the most (or is a hit ball is) t
        There are 4 small groups.
        The biggest group is uvwz
        The smallest group is hgd
        The difference between the number of letters in the biggest group and the number of letters in the smallest group is 1
        After dividing the difference the final result is 3.25

        Process finished with exit code 0

  1. Ivan Zhang is the winner for this week. We only have one winner so based on the rule Ivan is only awarded as the Quickest Problem Solver (Most Efficient Coder is skipped)

Leave a Reply