Skip to content

Commit dd70876

Browse files
committed
1 parent 7bbc71f commit dd70876

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# [Largest Square Inside A Circle](https://www.codewars.com/kata/largest-square-inside-a-circle "https://www.codewars.com/kata/5887a6fe0cfe64850800161c")
22

3-
Determine the **area** of the largest square that can fit inside a circle with radius *r*.
3+
Determine the **area** of the largest square that can fit inside a circle with radius *r*.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
interface Kata {
2+
static int areaLargestSquare(int r) {
3+
return 2 * r * r;
4+
}
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import static org.junit.jupiter.api.Assertions.assertEquals;
2+
3+
import org.junit.jupiter.params.ParameterizedTest;
4+
import org.junit.jupiter.params.provider.CsvSource;
5+
6+
class AreaLargestSquareTest {
7+
@ParameterizedTest
8+
@CsvSource(textBlock = """
9+
5, 50
10+
7, 98
11+
15, 450
12+
""")
13+
void sample(int r, int expected) {
14+
assertEquals(expected, Kata.areaLargestSquare(r));
15+
}
16+
}

0 commit comments

Comments
 (0)