/Challenges

Programming Challenges. Fork the repo, then do a pull request to submit your solution

Primary LanguageRuby

Coding Challenges

Simple. Fork the repo, complete the challenge (in any language you want), prefixed with your Github username and then submit a pull request. We encourage atomic commits. One change/task per commit.

Contributors

@askl56

@dansteele

@hunj

@scripore

Maths

  1. Fibonacci Sequence - Enter a number and have the program generate the Fibonacci sequence to that number or to the Nth number.

  2. FizzBuzz - The age old classic. Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz"

  3. Multiples of 3 and 5 - If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.

  4. Digital Root - The digital root (also repeated digital sum) of a non-negative integer is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached. For example, the digital root of 65,536 is 7, because 6 + 5 + 5 + 3 + 6 = 25 and 2 + 5 = 7.

  5. Sieve of Eratosthenes - The sieve of Eratosthenes is one of the most efficient ways to find all of the smaller primes (below 10 million or so).

  6. SquareSum Challenge - Write a method that squares all of the numbers passed into it (in an array) and sums them together.

  7. Multiplication Tables - Create a function that accepts dimensions, of Rows x Columns, as parameters in order to create a multiplication table sized according to the given dimensions.

  8. Hailstone Sequence - Start with any positive integer (an initial seed) and obtain a sequence of numbers by following: if number is even divite it by two, if it is odd multiply it by 3 and add one. Repeat.

  9. Next Prime Number - Have the program find prime numbers until the user chooses to stop asking for the next one.

Programs

  1. Lumberjack Pile Problem - Help the lumberjacks stack their logs!

Ruby Exercises with RSpec

String Manipulation Category - Exercises involving string manipulation

  1. String Reversal - The task is to reverse a string so that the method reverse_string with a parameter of "too" will return "oot". Complete this exercise without using the .reverse method.

  2. String Equivalence - Two strings are considered equivalent if they both contain same alphabets. For example, "foobar" and "rabfoo" are considered equivalent, but "FOOBAR" is not (note the capital letters). Write String#equivalent_with? method to complete this exercise.