Where the idea comes from
There was an Internet test that I did because of a job application a few weeks ago. The assignment was a very classic question and I knew the solution for the assignment. There was an opportunity to chose the language to write code so I started to code in C++. I did not test my code during inserting statements in the web base interface that was prepared to do the test. When the code inserting was almost finished I did the first run to check the code. The result was a very long list of errors. So I copied my code to a local IDE (Eclipse) and tested the code with a standard compiler on a Linux environment. The code was run without any kinds of error or warning. Suddenly I realized that the test environment doesn't support ANSI C++ earlier than 10. Unfortunately there was no time to right the code in a new way so I lost the test but it popped an idea to write all possible solutions to challenge my self to solve a problem.
Two first solutions took about an hour, the third one took about a day, for the fourth one I spent about four days but still is not completed.
Are you interested in challenging yourself by finding a new solution for a simple question? Join me @ https://github.com/tOSuser/ShoesSize
1 - Algorithm should be not used before by the other solutions that have been already done.
2 - The technique to code should be unique and not be used before by the other solutions that have been already done.
The task is divided into two parts.
Problem 1): popular_size
Find/return the most popular shoe size in the given list of shoe sizes and associated names. If there is no uniquely popular shoe size, return -1.
Problem 2): popular_name
Find/return the most popular name for the most popular shoe size. If there is no uniquely common name, OR if there is no uniquely popular shoe size, return an empty string. Names are case sensitive.
Solution A - Using vector to re-table elements to be compatible with c++ standard libraries such as 'vector', 'list' and 'algorithm' - Smallest code
Solution B - Tracing un-utilized data table without storing data - Fastest code
Solution C - The bindery tree method
Solution D -