Skip to content

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

License

Notifications You must be signed in to change notification settings

diljithbalakrishnan/Challenges

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/challenge per commit.

Contributors

@askl56

@hunj

@scripore

@adammenges

@imjching

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.

  10. Vampire Numbers - In mathematics, a vampire number (or true vampire number) is a composite natural number v, with an even number of digits n, that can be factored into two integers x and y each with n/2 digits and not both with trailing zeroes, where v contains precisely all the digits from x and from y, in any order, counting multiplicity. x and y are called the fangs.

  11. Valid Parentheses - The basic idea is to create a method that takes a string as input, and returns a boolean. True if the parentheses in the string are valid, false if not. E.g. () is valid. )( is not.

  12. Caesars Cipher - In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence.

  13. Happy Numbers - A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers.

  14. Dottie Number - This is the number you get when you type any number into a scientific calculator and then repeatedly press the cos button, with the calculator set to radians. The number displayed updates, getting closer and closer to a certain number, and eventually stops changing.

Project Euler - The famous Project Euler problem set, replete with solutions. Please submit your own, in any language.

Programs

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

  2. 99 Bottles of Beer - In this puzzle, write code to print out the entire "99 bottles of beer on the wall" song.

  3. Garland Words - A garland word is one that starts and ends with the same N letters in the same order, for some N greater than 0, but less than the length of the word.

  4. Palindromic Words - To covert nearly any number into a palindromic number you operate by reversing the digits and adding and then repeating the steps until you get a palindromic number.

  5. Rock Paper Scissors - Recreate the fun children's game, Rock, Paper, Scissors

  6. Towers of Hanoi - In this task, the goal is to solve the (Towers of Hanoi)[https://en.wikipedia.org/wiki/Towers_of_Hanoi] problem with recursion.

  7. Palindrome Detection - Write at least one function/method (or whatever it is called in your preferred language) to check if a sequence of characters (or bytes) is a palindrome or not.

  8. ABC Problem - You are given a collection of ABC blocks. Just like the ones you had when you were a kid. There are twenty blocks with two letters on each block. You are guaranteed to have a complete alphabet amongst all sides of the blocks.

  9. Ruth-Aaron Pairs - In mathematics, a Ruth–Aaron pair consists of two consecutive integers (e.g. 714 and 715) for which the sums of the distinct prime factors of each integer are equal.

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 54.4%
  • Python 11.8%
  • JavaScript 10.8%
  • Clojure 7.0%
  • Elixir 3.9%
  • Scala 3.3%
  • Other 8.8%