Skip to content

Instantly share code, notes, and snippets.

View michaelmiller2116's full-sized avatar

Mike Miller michaelmiller2116

View GitHub Profile
@michaelmiller2116
michaelmiller2116 / codeWarsSolutions
Last active March 26, 2018 22:44
Just a great list of solutions that I wish I had thought of.
Given two integers a and b, which can be positive or negative, find the sum of all the numbers between including them too and return it. If the two numbers are equal return a or b.
Note: a and b are not ordered!
Examples
GetSum(1, 0) == 1 // 1 + 0 = 1
GetSum(1, 2) == 3 // 1 + 2 = 3
GetSum(0, 1) == 1 // 0 + 1 = 1
GetSum(1, 1) == 1 // 1 Since both are same
GetSum(-1, 0) == -1 // -1 + 0 = -1