Skip to content

simplonco/ruby-challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Ruby challenges

Training / Ruby / Challenges

Most of these problems are taken from exercism.io !

Il buono, il brutto, il cattivo

The exercises are ordered roughly in order of difficulty, but it's a bit haphazard.

How to run tests locally?

# Install ruby:
$ sudo apt-get install ruby

# Go inside your project folder and:
$ ruby *test.rb --verbose

http://www.commitstrip.com/fr/2016/02/22/when-the-functional-tests-are-all-red/

Hello World

Write a program that greets the user by name, or by saying "Hello, World!" if no name is given.

README

FizzBuzz

1, 2, Fizz, 3, Buzz, Fizz

README

Hamming 

Write a program that can calculate the Hamming difference between two DNA strands.

README

Gigasecond 

Write a program that will calculate the date that someone turned or will celebrate their 1 Gs anniversary.

README

Rna Transcription 

Write a program that, given a DNA strand, returns its RNA complement (per RNA transcription).

README

Raindrops 

Write a program that converts a number to a string, the contents of which depends on the number's prime factors.

README

Difference Of Squares 

Find the difference between the sum of the squares and the square of the sums of the first N natural numbers.

README

Pangram 

Determine if a sentence is a pangram.

README

Sieve 

Write a program that uses the Sieve of Eratosthenes to find all the primes from 2 up to a given number.

README

Roman Numerals 

Write a function to convert from normal numbers to Roman Numerals: e.g.

README

Robot Name 

Write a program that manages robot factory settings.

README

Nth Prime 

Write a program that can tell you what the nth prime is.

README

Leap 

Write a program that will take a year and report if it is a leap year.

README

Grains 

Write a program that calculates the number of grains of wheat on a chessboard given that the number on each square doubles.

README

Word Count 

Write a program that given a phrase can count the occurrences of each word in that phrase.

README

Bob 

Bob is a lackadaisical teenager. In conversation, his responses are very limited.

README

Food Chain 

Write a program that generates the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly'

README

Run Length Encoding 

Implement run-length encoding and decoding.

README

Binary 

Write a program that will convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles

README

Accumulate 

Implement the `accumulate` operation, which, given a collection and an operation to perform on each element of the collection, returns a new collection containing the result of applying that operation to each element of the input collection.

README

Sum Of Multiples 

Write a program that, given a number, can find the sum of all the multiples of particular numbers up to but not including that number.

README

Grade School 

Write a small archiving program that stores students' names along with the grade that they are in.

README

Series 

Write a program that will take a string of digits and give you all the contiguous substrings of length `n` in that string.

README

Phone Number 

Write a program that cleans up user-entered phone numbers so that they can be sent SMS messages.

README

Prime Factors 

Compute the prime factors of a given natural number.

README

Strain 

Implement the `keep` and `discard` operation on collections. Given a collection and a predicate on the collection's elements, `keep` returns a new collection containing those elements where the predicate is true, while `discard` returns a new collection containing those elements where the predicate is false.

README

Etl 

We are going to do the `Transform` step of an Extract-Transform-Load.

README

Trinary 

Write a program that will convert a trinary number, represented as a string (e.g. '102012'), to its decimal equivalent using first principles.

README

Beer Song 

Write a program which produces the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.

README

Bowling 

Score a bowling game

README

Space Age 

Write a program that, given an age in seconds, calculates how old someone is in terms of a given planet's solar years.

README

Anagram 

Write a program that, given a word and a list of possible anagrams, selects the correct sublist.

README

Binary Search Tree 

Write a program that inserts numbers and searches in a binary tree.

README

Crypto Square 

Implement the classic method for composing secret messages called a square code.

README

Clock 

Implement a clock that handles times without dates.

README

Acronym 

Convert a long phrase to its acronym

README

Scrabble Score 

Write a program that, given a word, computes the scrabble score for that word.

README

Nucleotide Count 

Given a DNA string, compute how many times each nucleotide occurs in the string.

README

Hexadecimal 

Write a program that will convert a hexadecimal number, represented as a string (e.g. "10af8c"), to its decimal equivalent using first principles (i.e. no, you may not use built-in or external libraries to accomplish the conversion).

README

Say 

Write a program that will take a number from 0 to 999,999,999,999 and spell out that number in English.

README

Meetup 

Calculate the date of meetups.

README

Queen Attack 

Write a program that positions two queens on a chess board and indicates whether or not they are positioned so that they can attack each other.

README

Palindrome Products 

Write a program that can detect palindrome products in a given range.

README

Bracket Push 

Make sure the brackets and braces all match.

README

Matrix 

Write a program that, given a string representing a matrix of numbers, can return the rows and columns of that matrix.

README

Saddle Points 

Write a program that detects saddle points in a matrix.

README

Triangle 

Write a program that can tell you if a triangle is equilateral, isosceles, or scalene.

README

Atbash Cipher 

Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.

README

House 

Write a program that outputs the nursery rhyme 'This is the House that Jack Built'.

README

Secret Handshake 

Write a program that will take a decimal number, and convert it to the appropriate sequence of events for a secret handshake.

README

Proverb 

For want of a horseshoe nail, a kingdom was lost, or so the saying goes. Write a program that outputs the full text of this proverbial rhyme.

README

Ocr Numbers 

Write a program that, given a 3 x 4 grid of pipes, underscores, and spaces, can determine which number is represented, or whether it is garbled.

README

Pig Latin 

Implement a program that translates from English to Pig Latin

README

Simple Linked List 

Write a simple linked list implementation that uses Elements and a List

README

Luhn 

Write a program that can take a number and determine whether or not it is valid per the Luhn formula.

README

Simple Cipher 

Implement a simple shift cipher like Caesar and a more secure substitution cipher

README

Wordy 

Write a program that takes a word problem and returns the answer as an integer.

README

Allergies 

Write a program that, given a person's allergy score, can tell them whether or not they're allergic to a given item, and their full list of allergies.

README

Poker 

Pick the best hand(s) from a list of poker hands.

README

Kindergarten Garden 

Write a program that, given a diagram, can tell you which plants each child in the kindergarten class is responsible for.

README

Linked List 

Implement a doubly linked list

README

Pythagorean Triplet 

There exists exactly one Pythagorean triplet for which a Find the product a * b * c.

README

Robot Simulator 

Write a robot simulator.

README

Twelve Days 

Write a program that outputs the lyrics to 'The Twelve Days of Christmas'

README

Circular Buffer 

A data structure that uses a single, fixed-size buffer as if it were connected end-to-end.

README

Largest Series Product 

Write a program that, when given a string of digits, can calculate the largest product for a contiguous substring of digits of length n.

README

Binary Search 

Write a program that implements a binary search algorithm.

README

Two Bucket 

Given two buckets of different size, write a program to demonstrate how to measure an exact number of liters.

README

Pascals Triangle 

Write a program that computes Pascal's triangle up to a given number of rows.

README

Custom Set 

Create a custom set type.

README

Minesweeper 

Write a program that adds the numbers to a minesweeper board

README

Scale Generator 

Write a program that can generate musical scales, given a starting note and a set of intervals.

README

Protein Translation 

Write a program that will translate RNA sequences into proteins.

README

Perfect Numbers 

The Greek mathematician Nicomachus devised a classification scheme for natural numbers.

README

About

It will maybe hurt a bit, but for your good! 🌵

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors