Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: kata/boiled-eggs #781

Merged
merged 2 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions kata/7-kyu/boiled-eggs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# [Boiled Eggs](https://www.codewars.com/kata/boiled-eggs "https://www.codewars.com/kata/52b5247074ea613a09000164")

You are the greatest chef on earth. No one boils eggs like you! Your restaurant is always full of guests, who love your boiled eggs. But
when there is a greater order of boiled eggs, you need some time, because you have only one pot for your job. How much time do you need?

## Your Task

Implement a function, which takes a non-negative integer, representing the number of eggs to boil. It must return the time in minutes (
integer), which it takes to have all the eggs boiled.

## Rules

* you can put at most 8 eggs into the pot at once
* it takes 5 minutes to boil an egg
* we assume, that the water is boiling all the time (no time to heat up)
* for simplicity, we also don't consider the time it takes to put eggs into the pot or get them out of it

## Example (Input --> Output)

```
0 --> 0
5 --> 5
10 --> 10
```
5 changes: 5 additions & 0 deletions kata/7-kyu/boiled-eggs/main/BoilingWater.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
interface BoilingWater{
static int cookingTime(int eggs) {
return (eggs + 7) / 8 * 5;
}
}
17 changes: 17 additions & 0 deletions kata/7-kyu/boiled-eggs/test/SolutionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

class SolutionTest {
@ParameterizedTest
@CsvSource(textBlock = """
0, 0
5, 5
10, 10
90072355, 56295225
""")
void sample(int eggs, int time) {
assertEquals(time, BoilingWater.cookingTime(eggs));
}
}
1 change: 1 addition & 0 deletions kata/7-kyu/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
- [Bits Battle](bits-battle "58856a06760b85c4e6000055")
- [Blood Moon](blood-moon "5cba04533e6dce000eaf6126")
- [Blowing Birthday Candles](blowing-birthday-candles "6630da20f925eb3007c5a498")
- [Boiled Eggs](boiled-eggs "52b5247074ea613a09000164")
- [Breaking chocolate problem](breaking-chocolate-problem "534ea96ebb17181947000ada")
- [Broken sequence](broken-sequence "5512e5662b34d88e44000060")
- [Bubblesort Once](bubblesort-once "56b97b776ffcea598a0006f2")
Expand Down