Skip to content

Latest commit

 

History

History
201 lines (130 loc) · 7.27 KB

README.md

File metadata and controls

201 lines (130 loc) · 7.27 KB

C# Exercises

Each subdirectory in this repository is an exercise.

Each exercise consists of a README.md and some automated tests.

Follow these instructions on how to get your C# development environment set up.

The exercises use NUnit. Follow this guide to get started.

Exercises

These are ordered roughly in order of difficulty. The README.md file for each exercise explains in more detail what the exercise is about.

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

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

gigasecond Write a program that calculates the moment when someone has lived for 10^9 seconds.

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

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

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.

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.

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

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

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

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

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.

bank-account Bank accounts can be accessed in different ways at the same time.

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

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

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

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.

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

robot-name Write a program that manages robot factory settings.

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

protein-translation Write a program that will translate RNA sequences into proteins.

clock Implement a clock that handles times without dates.

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

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

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

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.

binary-search Write a program that implements a binary search algorithm.

robot-simulator Write a robot simulator.

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

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.

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

acronym Convert a long phrase to its acronym

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

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.

saddle-points Write a program that detects saddle points in a matrix.

pythagorean-triplet There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product a * b * c.

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

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

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

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

prime-factors Compute the prime factors of a given natural number.

meetup Calculate the date of meetups.

all-your-base Write a program that will convert a number, represented as a sequence of digits in one base, to any other base.

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

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

roman-numerals Write a function to convert from normal numbers to Roman Numerals.

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

minesweeper Write a program that adds the numbers to a minesweeper board

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

linked-list Implement a doubly linked list

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

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.

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

tournament Tally the results of a small football competition.

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

pig-latin Implement a program that translates from English to Pig Latin

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

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

Source

These exercises are from the C# track on Exercism