Skip to content

Commit 0655f3d

Browse files
* docs: kata description * feat: kata/sort-arrays-ignoring-case --------- Co-authored-by: ParanoidUser <[email protected]>
1 parent b27d866 commit 0655f3d

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ slug.
2525

2626
| [1 kyu](/kata/1-kyu/index.md) | [2 kyu](/kata/2-kyu/index.md) | [3 kyu](/kata/3-kyu/index.md) | [4 kyu](/kata/4-kyu/index.md) | [5 kyu](/kata/5-kyu/index.md) | [6 kyu](/kata/6-kyu/index.md) | [7 kyu](/kata/7-kyu/index.md) | [8 kyu](/kata/8-kyu/index.md) | [beta](/kata/beta/index.md) | [retired](/kata/retired/index.md) |
2727
|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:---------------------------:|:---------------------------------:|
28-
| 0 | 1 | 2 | 26 | 48 | 445 | 608 | 228 | 59 | 82 |
28+
| 0 | 1 | 2 | 26 | 48 | 446 | 608 | 228 | 59 | 82 |
2929

3030
**Note:** The source code is written in Java 17 and may use language features that are incompatible
3131
with Java 8, 11.

kata/6-kyu/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@
346346
- [Some Fun with Aggregate Operations (Part 3)](some-fun-with-aggregate-operations-part-3 "5960e6cf09868d7f2f0000bc")
347347
- [Some Fun with Aggregate Operations (Part 4)](some-fun-with-aggregate-operations-part-4 "59623e9450091000150000d2")
348348
- [Sort array by sorting its smallest sub-array](sort-array-by-sorting-its-smallest-sub-array "59aac10dd0a5ff951100002a")
349+
- [Sort Arrays (Ignoring Case)](sort-arrays-ignoring-case "51f41fe7e8f176e70d0002b9")
349350
- [Sort the columns of a csv-file](sort-the-columns-of-a-csv-file "57f7f71a7b992e699400013f")
350351
- [Sort the odd](sort-the-odd "578aa45ee9fd15ff4600090d")
351352
- [Sort two arrays](sort-two-arrays "5818c52e21a33314e00000cb")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# [Sort Arrays (Ignoring Case)](https://www.codewars.com/kata/sort-arrays-ignoring-case "https://www.codewars.com/kata/51f41fe7e8f176e70d0002b9")
2+
3+
Sort the given **array of strings** in alphabetical order, case **insensitive**. For example:
4+
5+
```
6+
["Hello", "there", "I'm", "fine"] --> ["fine", "Hello", "I'm", "there"]
7+
["C", "d", "a", "B"]) --> ["a", "B", "C", "d"]
8+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import static java.util.stream.Stream.of;
2+
3+
interface Kata {
4+
static String[] sort(String[] names) {
5+
return of(names).sorted(String.CASE_INSENSITIVE_ORDER).toArray(String[]::new);
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import org.junit.jupiter.api.Test;
2+
3+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
4+
5+
class SolutionTest {
6+
@Test
7+
void sample() {
8+
assertArrayEquals(new String[]{"fine", "Hello", "I'm", "there"}, Kata.sort(new String[]{"Hello", "there", "I'm", "fine"}));
9+
assertArrayEquals(new String[]{"a", "B", "C", "d"}, Kata.sort(new String[]{"C", "d", "a", "B"}));
10+
assertArrayEquals(new String[]{"CodeWars"}, Kata.sort(new String[]{"CodeWars"}));
11+
assertArrayEquals(new String[]{}, Kata.sort(new String[]{}));
12+
}
13+
}

0 commit comments

Comments
 (0)