Know Your GPA

This semester has been brutal! You’ve had five classes, three of which are required for your major and two electives that turned out to be tougher than you anticipated. Yet, you pulled through the term without dropping a single course. You now have your grades and want to know your GPA for the semester.
Continue reading

Rotate the Grid

I’m not immersed in higher mathematics, therefore most of my programming puzzles tend to involve strings or other items I can easily comprehend. Beyond manipulating characters and strings, for my programming kung fu training I keep returning to the matrix or grid.
Continue reading

Write Your Own Integer Conversion

It’s not that programmers are lazy. Many professions involve a lot of copy-and-paste, borrowing stuff done before, re-purposing and re-using. Why re-invent the wheel? Still, doing so helps exercise your programming kung-fu as well as offers insights into how things work and why some operations are done the way they are.

As an example, consider the atoi() function.
Continue reading

Find the Duplicates

You’ll find multiple reasons to remove duplicates from a series of random numbers. The main reason is that the process or generating random numbers is capable of yielding duplicate values. But more importantly, if your list represents discrete items in the real world, such as playing cards, you can’t really have a duplicate value pop up.
Continue reading