File tree Expand file tree Collapse file tree 4 files changed +25
-0
lines changed
largest-square-inside-a-circle Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 298298- [ Largest 5 digit number in a series] ( largest-5-digit-number-in-a-series " 51675d17e0c1bed195000001 ")
299299- [ Largest Elements] ( largest-elements " 53d32bea2f2a21f666000256 ")
300300- [ Largest pair sum in array] ( largest-pair-sum-in-array " 556196a6091a7e7f58000018 ")
301+ - [ Largest Square Inside A Circle] ( largest-square-inside-a-circle " 5887a6fe0cfe64850800161c ")
301302- [ Last Survivor] ( last-survivor " 609eee71109f860006c377d1 ")
302303- [ Last] ( last " 541629460b198da04e000bb9 ")
303304- [ Latin Squares] ( latin-squares " 645fb55ecf8c290031b779ef ")
Original file line number Diff line number Diff line change 1+ # [ Largest Square Inside A Circle] ( https://www.codewars.com/kata/largest-square-inside-a-circle " https://www.codewars.com/kata/5887a6fe0cfe64850800161c ")
2+
3+ Determine the ** area** of the largest square that can fit inside a circle with radius * r* .
Original file line number Diff line number Diff line change 1+ interface Kata {
2+ static int areaLargestSquare (int r ) {
3+ return 2 * r * r ;
4+ }
5+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments