Skip to content

Instantly share code, notes, and snippets.

View dlresende's full-sized avatar

Diego Lemos dlresende

View GitHub Profile
@dlresende
dlresende / gist:60b4c0240ad020a323ad
Last active March 20, 2021 19:51
FooBarQix Kata

FooBarQix Kata

Write a program that prints numbers from 1 to 100, one number per line. For each printed number, use the following rules:

  1. if the number is divisible by 3 or contains 3, replace 3 by "Foo";
  2. if the number is divisible by 5 or contains 5, replace 5 by "Bar";
  3. if the number is devisible by 7 or contains 7, replace 7 by "Qix".

Example: 1

@dlresende
dlresende / gist:d2faf9f0ebb2ed781749
Last active March 23, 2017 00:50
Roman Numerals Kata

Roman Numerals Converter Kata

Write a program to convert decimals to Roman numerals. Example:

  • roman(1) = "I"
  • roman(4) = "IV"
  • roman(1954) = "MCMLIV"
  • roman(1990) = "MCMXC"

Use the following table to make the correspondence between Roman numerals and decimals:

Fizz Buzz Kata

  1. If the number is divisible by 3, should print "Fizz"
  2. If the number is divisible by 5, should print "Buzz"
  3. If the number is divisible by both 3 and 5, should print "Fizz Buzz"
  4. Otherwise, should print the number

Example: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 Fizz Buzz ...

@dlresende
dlresende / gist:274194dd6ec993eb5ec5
Last active September 6, 2018 10:06
RPN Calculator Kata

RPN Calculator Kata

A RPN calculator program computes expressions written in RPN (Reverse Polish Notation). A RPN expression (or a postfix expression) is one of the following:

  • a number X, in which case the value of the expression is that of X;
  • a sequence of the form E1 E2 O, where E1 and E2 are postfix expressions and O is an arithmetic operation; in this case, the value of the expression is that of E1 O E2

The following are RPN expressions: