# ggarciajr/kata-coder

Switch branches/tags
Nothing to show
Commits on May 16, 2011
1. ggarciajr committed May 16, 2011
Commits on May 13, 2011
1. ggarciajr committed May 13, 2011
`Tentative #2`
2. ggarciajr committed May 13, 2011
`Tentative #1`
Commits on May 10, 2011
1. ggarciajr committed May 10, 2011
```…e values do not exceed four million, find the sum of the even-valued terms.

Tentative #2

Using for comprehension and math optimization```
Commits on May 9, 2011
1. ggarciajr committed May 9, 2011
```…e values do not exceed four million, find the sum of the even-valued terms.

Tentative #1

Using for comprehension```
Commits on May 6, 2011
1. ggarciajr committed May 6, 2011
```…e values do not exceed four million, find the sum of the even-valued terms.

Tentative #2

removing an unused import```
Commits on May 5, 2011
1. ggarciajr committed May 5, 2011
```…e values do not exceed four million, find the sum of the even-valued terms.

Tentative #2

Applying some math to make the algorithm a little bit faster.```
Commits on Apr 29, 2011
1. ggarciajr committed Apr 29, 2011
```…e values do not exceed four million, find the sum of the even-valued terms.

Tentative #2```
Commits on Apr 26, 2011
1. ggarciajr committed Apr 26, 2011
```…e values do not exceed four million, find the sum of the even-valued terms.

Tentative #1```
Commits on Apr 4, 2011
1. ggarciajr committed Apr 4, 2011
```Sixth solution.

A whole new approach was attempted here. We have removed the loop throughout every single number to check if it is a multiple of 3 ou 5 to a mathematical approach using 2 different formulaes.
1. the sum of the multiples 3 or 5 = sum of multiples of 3 + sum of multiples of 5 - sum of multiples of 3 * 5
2. the sum of multiples of 3 = ((n * (n + 1)) / 2) * d
where n = 1000 / 3 (upper limit divided by the multiple)
d = multiple (in this case 3)

with this solution we solve the performance issue of the previous solution by providing a constant-time solution.
previous solution = 1 operation per number (i.e 10^10 will cause the function to run 10^10 steps)
new solution = 3 operation per limit (1 to compute the sum of multiples of 3, 1 to compute the sum of multiples of 5, 1 to compute the sum of multiples of 3 * 5)```
2. ggarciajr committed Apr 4, 2011
```Sixth solution.

A whole new approach was attempted here. We have removed the loop throughout every single number to check if it is a multiple of 3 ou 5 to a mathematical approach using 2 different formulaes.
1. the sum of the multiples 3 or 5 = sum of multiples of 3 + sum of multiples of 5 - sum of multiples of 3 * 5
2. the sum of multiples of 3 = ((n * (n + 1)) / 2) * d
where n = 1000 / 3 (upper limit divided by the multiple)
d = multiple (in this case 3)

with this solution we solve the performance issue of the previous solution by providing a constant-time solution.
previous solution = 1 operation per number (i.e 10^10 will cause the function to run 10^10 steps)
new solution = 3 operation per limit (1 to compute the sum of multiples of 3, 1 to compute the sum of multiples of 5, 1 to compute the sum of multiples of 3 * 5)```
3. ggarciajr committed Apr 4, 2011
```Seventh solution.

A whole new approach was attempted here. We have removed the loop throughout every single number to check if it is a multiple of 3 ou 5 to a mathematical approach using 2 different formulaes.
1. the sum of the multiples 3 or 5 = sum of multiples of 3 + sum of multiples of 5 - sum of multiples of 3 * 5
2. the sum of multiples of 3 = ((n * (n + 1)) / 2) * d
where n = 1000 / 3 (upper limit divided by the multiple)
d = multiple (in this case 3)

with this solution we solve the performance issue of the previous solution by providing a constant-time solution.
previous solution = 1 operation per number (i.e 10^10 will cause the function to run 10^10 steps)
new solution = 3 operation per limit (1 to compute the sum of multiples of 3, 1 to compute the sum of multiples of 5, 1 to compute the sum of multiples of 3 * 5)```
4. ggarciajr committed Apr 4, 2011
Commits on Apr 1, 2011
1. ggarciajr committed Apr 1, 2011
```Fourth solution.

A whole new approach was attempted here. We have removed the loop throughout every single number to check if it is a multiple of 3 ou 5 to a mathematical approach using 2 different formulaes.
1. the sum of the multiples 3 or 5 = sum of multiples of 3 + sum of multiples of 5 - sum of multiples of 3 * 5
2. the sum of multiples of 3 = ((n * (n + 1)) / 2) * d
where n = 1000 / 3 (upper limit divided by the multiple)
d = multiple (in this case 3)

with this solution we solve the performance issue of the previous solution by providing a constant-time solution.
previous solution = 1 operation per number (i.e 10^10 will cause the function to run 10^10 steps)
new solution = 3 operation per limit (1 to compute the sum of multiples of 3, 1 to compute the sum of multiples of 5, 1 to compute the sum of multiples of 3 * 5)```
Commits on Mar 30, 2011
1. ggarciajr committed Mar 30, 2011
```Third solution.
Refactoring fkSum to receive a list of multiples.
Now we have a very generic method to calculate the sum of multiples
of a given list less than an upperLimit```
2. ggarciajr committed Mar 30, 2011
```Second solution.
Refactoring fkSum to receive the upperLimit value as a param.```
3. ggarciajr committed Mar 30, 2011
```First solution.
Implementing a haskell function to compute the sum of all multiples
of 3 or 5 less than 1000.```
4. ggarciajr committed Mar 30, 2011
Commits on Mar 29, 2011
1. ggarciajr committed Mar 29, 2011
```Sixth solution.
Methods sum was refactored to use be more concise.```
2. ggarciajr committed Mar 29, 2011
```Fifth solution.
Methods sum was refactored to use pattern matching.```
3. ggarciajr committed Mar 29, 2011
```Fourth solution.
Methods sum and isMultiple was refactored in order to get a more functional code.
Notice that the code is a bit more concise now.```
4. ggarciajr committed Mar 29, 2011
```Third solution.
Method sum was refactored and now receives a sequence of ints as a parameter.
And now, we have a little more generic function. It computes the sum of any given multiples for any given upperLimit
We should notice the OO style in this solution.```
5. ggarciajr committed Mar 29, 2011
```Second solution. No use of param or helper method.
Method sum was refactored and now receives the upperLimit int as a parameter.
And now, we have a little more generic function. But it only computes the sum of multiples of 3 or 5.
We should notice the OO style in this solution.```
6. ggarciajr committed Mar 29, 2011
```First solution. No use of param or helper method.
This is a very specific method and only works in one case.
We should notice the OO style in this solution.```
7. ggarciajr committed Mar 29, 2011
8. ggarciajr committed Mar 29, 2011
`Third solution. The method sum was refactored and now it receives a parameter. That parameter is the upper limit, so we can find out what is the sum of all multiples of a given combination (i.e 3 and 5 or 2 or 6, 7) less than the upper limit`
9. ggarciajr committed Mar 29, 2011
`Second solution. The method sum was refactored and now it receives a parameter. That parameter is the upper limit, so we can find out what is the sum of all multiples of 3 or 5 less than the upper limit`
10. ggarciajr committed Mar 29, 2011
```First solution. No use of param or helper method.
This is a very specific method and only works in one case.```
11. ggarciajr committed Mar 29, 2011
Commits on Mar 28, 2011
1. ggarciajr committed Mar 28, 2011
```Fifth  solution.
Method is_multiple was refactored. and it's more concise now.```
2. ggarciajr committed Mar 28, 2011
```Fourth solution.
Method sum was refactored and it now receives an array 'multiples' as param  that is used to filter the numbers that will be summed up.
This is a more generic solution since it accepts the upper limit and and an array of multiples as parameters.
And, now we can sum up the multiples of any upper limit number using any combination of multiples.```
3. ggarciajr committed Mar 28, 2011
```Third solution.
Method sum was refactored and it now receives a param 'multiple' that is used to filter the numbers that will be summed up.
This is a more generic solution since it accepts the upper limit and the multiple as parameters, but it only works for one multiple at a time.```
4. ggarciajr committed Mar 28, 2011
```Second solution.
Method sum was refactored and it now receives a param 'upper_limit' that is used to limit the sum of multiples.
This is a more generic solution, but it only works for multiples of 3 or 5.```
5. ggarciajr committed Mar 28, 2011
```First solution. No use of param or helper method.
This is a very specific method and only works in one case.```
6. ggarciajr committed Mar 28, 2011