Skip to content

ikushum/Ruby-Challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby Challenges

This repo contains 10 coding challenges solved in Ruby language

  1. anagram.rb: Given a word and a list of possible anagrams, it select the correct sublist. Given "listen" and a list of candidates like "enlists" "google" "inlets" "banana" the program should return a list containing "inlets".

  2. bst.rb: A menu driven program that allows us to insert and search for an integer in a Binary Search Tree.

  3. change.rb: It correctly determine the fewest number of coins to be given to a customer such that the sum of the coins' value would equal the correct amount of change. An input of 15 with [1, 5, 10, 25, 100] should return one nickel (5) and one dime (10) or [0, 1, 1, 0, 0]. Similary an input of 40 with [1, 5, 10, 25, 100] should return one nickel (5) and one dime (10) and one quarter (25) or [0, 1, 1, 1, 0]

  4. isomer.rb: Determines if a word or phrase is an isogram. An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter. Examples of isograms are lumberjacks, background, downstream etc. The word isograms, however, is not an isogram, because the s repeats.

  5. leap.rb: Given a year as an input, it determines if the year is leap or not.

  6. panagram.rb: Determines if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma, "every letter") is a sentence using every letter of the alphabet at least once. The best known English pangram is: The quick brown fox jumps over the lazy dog.

  7. pythagorean_triplet.rb: A Pythagorean triplet is a set of three natural numbers, {a, b, c}, for which, a2 + b2 = c2. For example : 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. The program finds the product abc.

  8. raindrops.rb: Converts a number to a string, the contents of which depend on the number's factors. If the number has 3 as a factor, output 'Pling'. If the number has 5 as a factor, output 'Plang'. If the number has 7 as a factor, output 'Plong'. If the number does not have 3, 5, or 7 as a factor, it just passes the number's digits straight through.

  9. roman: Given a integer, the program prints its corresponding roman number equivalent.

  10. word_count: Given a phrase, the program counts the occurrences of each word in that phrase. For example for the input "olly olly in come free", it prints: olly: 2 in: 1 come: 1 free: 1

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages