To start of my tenure as contest master, I'll test the waters with some quick contests. If everyone likes them then I'll make some more on a (hopefully) almost daily basis. I say almost daily because it's not easy coming up with something good and my time is limited.

Please PM me with suggestions and comments so that I can adjust my methods to meet the demand.

The Almost Daily Contest will run for a set amount of time. Anyone may participate by emailing their submission to happyfrosty@hotmail.com with the subject "Almost Daily Contest Entry". Be sure to specify which difficulty level you're solving. There's no need to sign up ahead of time.

Almost Daily Contest #1

Beginner:

Write a function in C or C++:

long double digRev ( int val )

that takes any valid integer and reverses the digits. Your function should work for every valid int from INT_MAX to INT_MIN. Example:

digRev ( 12345 );

This should result in 54321. You will be graded on the following categories:

Speed: Nice and toasty.

Elegance: Easy on the eyes.

Portability: It needs to run wherever I test it.

Intermediate:

A triangle can be formed with side lengths 4, 5, and 8. It's not possible to form a triangle with side lengths of 4, 5, and 9.

You have eight sticks, no three of which can be used to form a triangle. Write a program to calculate the shortest possible length of the longest stick where the shortest stick is length 1.

Correctness: Does it work right?

Speed: Is efficient?

Elegance: Elegant solutions are most welcome

Hints: Triangle Inequality

Advanced:

Write a function in C or low level C++ (no STL):

char findFirstNonRepeat ( char *s );

that returns the first character that is not repeated in the string. For example, in "google", the first nonrepeated character is 'l', in "better", the first nonrepeated character is 'b'.

You may use any number and type of helper functions and data structures, but the algorithmmust have a complexity of O(n) or better. Your function will be graded on:

Speed: Pedal to the metal

Elegance: Nifty algorithms are always good

Contest End: Tuesday, August 5, 2003