Solutions for Exercises for Programmers, by Brian Hogan
I'm going to implement the solution to each exercise in a handful of languages. Largely I hope to cover the exercises with Ruby and Go, and later Haskell, Python, Elm, Rust, or C.
Each exercise has a few "challenges" appended, elaborating on the original problem. I'm going to ignore this on the first run through, then revisit them subsequently.
Each exercise will have its own self-contained sub-directory within this repository including a README to document the problem and related details.
Within each exercise directory will be sub-directories enclosing solutions, one per language.
How to execute the implemented solutions will depend on each language, among other things.
All solutions were written with Ruby 2.2.3 (MRI/CRuby). With a compatible Ruby installed they should all be executable in the usual fashion, by passing the file name to the interpreter.
$ ruby solution.rb
Additionally, all of the Ruby solutions have a "shebang" (#!
) specified, so
you may be able to execute them directly, depending.
$ ./solution.rb
All solutions in Go are written against 1.5.2. They can be built or run as-is in the given directory, if you have the Go platform installed.
$ go build main.go
$ ./main
$ go run main.go
- Saying Hello
- Counting the Number of Characters
- Printing Quotes
- Mad Lib
- Simple Math
- Retirement Calculator
- Area of a Rectangular Room
- Pizza Party
- Paint Calculator
- Self-Checkout
- Currency Conversion
- Computing Simple Interest
- Determining Compound Interest
- Tax Calculator
- Password Validation
- Legal Driving Age
- Blood Alcohol Calculator
- Temperature Converter
- BMI Calculator
- Multistate Sales Tax Calculator
- Numbers to Names
- Comparing Numbers
- Troubleshooting Car Issues
- Anagram Checker
- Password Strength Indicator
- Months to Pay Off a Credit Card
- Validating Inputs
- Adding Numbers
- Handling Bad Input
- Multiplication Table
- Karvonen Heart Rate
- Guess the Number Game
- Magic 8 Ball
- Employee List Removal
- Picking a Winner
- Computing Statistics
- Password Generator
- Filtering Values
- Sorting Records
- Filtering Records
- Name Sorter
- Parsing a Data File
- Website Generator
- Product Search
- Word Finder
- Word Frequency Finder
- Who’s in Space?
- Grabbing the Weather
- Flickr Photo Search
- Movie Recommendations
- Pushing Notes to Firebase
- Creating Your Own Time Service
- Todo List
- URL Shortener
- Text Sharing
- Tracking Inventory
- Trivia App