-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f42cdd6
commit 712de64
Showing
12 changed files
with
349 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,51 @@ | ||
# Fibonacci kata | ||
|
||
- Write a function to generate the Fibonacci number for the nth position. | ||
- Example: int Fibonacci(int position) | ||
- First Fibonacci numbers in the sequence are: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 | ||
|
||
| **Input** | **Output** | | ||
| --------- | ---------- | | ||
| **0** | 0 | | ||
| **1** | 1 | | ||
| **2** | 1 | | ||
| **3** | 2 | | ||
| **4** | 3 | | ||
| **5** | 5 | | ||
| **6** | 8 | | ||
| **7** | 13 | | ||
| **8** | 21 | | ||
| **9** | 34 | | ||
|
||
## Folow TDD rules stryctly | ||
|
||
1. Write production code only to pass a failing unit test. | ||
2. Write no more of a unit test than sufficient to fail (compilation failures are failures). | ||
3. Write no more production code than necessary to pass the one failing unit test. | ||
# Fibonacci Kata | ||
|
||
## Problem Description | ||
|
||
Write a function that returns the Fibonacci number at a given position. | ||
|
||
### Function Signature | ||
|
||
```typescript | ||
function fibonacci(position: number): number; | ||
``` | ||
|
||
### Sequence Definition | ||
|
||
The Fibonacci sequence is defined where each number is the sum of the two preceding ones, starting from 0 and 1. | ||
|
||
### Examples | ||
|
||
The first 10 Fibonacci numbers are: | ||
|
||
| Position | Value | | ||
| -------- | ----- | | ||
| 0 | 0 | | ||
| 1 | 1 | | ||
| 2 | 1 | | ||
| 3 | 2 | | ||
| 4 | 3 | | ||
| 5 | 5 | | ||
| 6 | 8 | | ||
| 7 | 13 | | ||
| 8 | 21 | | ||
| 9 | 34 | | ||
|
||
## TDD Rules | ||
|
||
1. ✅ Write production code only to pass a failing unit test | ||
2. ✅ Write only enough of a unit test to make it fail | ||
3. ✅ Write only enough production code to make the failing test pass | ||
|
||
## Suggested Test Cases | ||
|
||
1. Test position 0 returns 0 | ||
2. Test position 1 returns 1 | ||
3. Test position 2 returns 1 | ||
4. Test larger positions (e.g., 8 returns 21) | ||
5. Test negative positions (should handle edge case) | ||
|
||
## Resources | ||
|
||
TestDesiderata by Kent Beck: <https://kentbeck.github.io/TestDesiderata> | ||
- [Test Desiderata by Kent Beck](https://kentbeck.github.io/TestDesiderata) | ||
- [Fibonacci Sequence on Wikipedia](https://en.wikipedia.org/wiki/Fibonacci_number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
# Stack kata | ||
# Stack Kata | ||
|
||
- Implement a Stack class with the following public methods: | ||
- `push(value: number) : void` | ||
- `pop() : number` | ||
- Stack should throw an exception if popped when empty. | ||
## Requirements | ||
|
||
| **push** | **pop** | | ||
| -------- | ------- | | ||
| -- | throw | | ||
| 1 | 1 | | ||
| 2 | 2 | | ||
| 1, 2 | 2, 1 | | ||
| 1, 2, 3 | 3, 2, 1 | | ||
Implement a Stack class with the following public methods: | ||
|
||
## Folow TDD rules stryctly | ||
- `push(value: number): void` - Adds a value to the top of the stack | ||
- `pop(): number` - Removes and returns the top value from the stack | ||
- The stack should throw an exception when attempting to pop from an empty stack | ||
|
||
1. Write production code only to pass a failing unit test. | ||
2. Write no more of a unit test than sufficient to fail (compilation failures are failures). | ||
3. Write no more production code than necessary to pass the one failing unit test. | ||
## Test Cases | ||
|
||
| Input (push) | Expected Output (pop) | | ||
| ------------ | --------------------- | | ||
| Empty Stack | throws Exception | | ||
| push(1) | 1 | | ||
| push(2) | 2 | | ||
| push(1,2) | 2, then 1 | | ||
| push(1,2,3) | 3, then 2, then 1 | | ||
|
||
## TDD Rules | ||
|
||
1. ✅ Write production code only to pass a failing unit test | ||
2. ✅ Write only enough of a unit test to make it fail | ||
3. ✅ Write only enough production code to make the failing test pass | ||
|
||
## Additional Guidelines | ||
|
||
- Follow the "Red-Green-Refactor" cycle | ||
- Keep tests and production code as simple as possible | ||
- Commit after each successful test | ||
|
||
## Resources | ||
|
||
TestDesiderata by Kent Beck: <https://kentbeck.github.io/TestDesiderata> | ||
- [TestDesiderata by Kent Beck](https://kentbeck.github.io/TestDesiderata) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.