Skip to content

Commit dfe7c0c

Browse files
committedMar 19, 2024
day 82/366
1 parent 6be28dc commit dfe7c0c

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"java.project.sourcePaths": ["src"],
3+
"java.project.outputPath": "bin",
4+
"java.project.referencedLibraries": [
5+
"lib/**/*.jar"
6+
]
7+
}

Diff for: ‎My Solutions/082_ Running out of space/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Getting Started
2+
3+
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
4+
5+
## Folder Structure
6+
7+
The workspace contains two folders by default, where:
8+
9+
- `src`: the folder to maintain sources
10+
- `lib`: the folder to maintain dependencies
11+
12+
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
13+
14+
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
15+
16+
## Dependency Management
17+
18+
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
1.04 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/* Codewars Coding Challenge
2+
3+
Day 82/366
4+
5+
Level 7kyu
6+
7+
Running out of space
8+
9+
Kevin is noticing his space run out! Write a function that removes the spaces from the values and returns an array showing the space decreasing.
10+
For example, running this function on the array ['i', 'have','no','space'] would produce ['i','ihave','ihaveno','ihavenospace']
11+
12+
13+
public class OutOfSpace {
14+
15+
public static String[] spacey(String[] array) {
16+
// TODO: Figure it out :)
17+
return null;
18+
}
19+
20+
}
21+
22+
23+
https://www.codewars.com/kata/56576f82ab83ee8268000059/train/java
24+
*
25+
*
26+
*/
27+
28+
public class OutOfSpace {
29+
public static String[] spacey(String[] array) {
30+
String[] result = new String[array.length];
31+
String noSpace = "";
32+
for (int i = 0; i < array.length; i++) {
33+
noSpace += array[i];
34+
result[i] = noSpace;
35+
}
36+
return result;
37+
}
38+
}
39+
40+
41+
/*
42+
* Sample Tests
43+
*
44+
*
45+
* import java.util.Arrays;
46+
import org.junit.jupiter.api.*;
47+
48+
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
49+
class SolutionTest {
50+
51+
@Test
52+
@Order(1)
53+
@DisplayName("Strings with lower letters only")
54+
void test1() {
55+
String[] input = new String[]{"kevin", "has", "no", "space"};
56+
String[] expected = new String[]{"kevin", "kevinhas", "kevinhasno", "kevinhasnospace"};
57+
Assertions.assertArrayEquals(expected, OutOfSpace.spacey(input));
58+
}
59+
60+
@Test
61+
@Order(2)
62+
@DisplayName("Strings with camel case")
63+
void test2() {
64+
String[] input = new String[]{"Camel", "Case", "Should", "Remain"};
65+
String[] expected = new String[]{"Camel", "CamelCase", "CamelCaseShould", "CamelCaseShouldRemain"};
66+
Assertions.assertArrayEquals(expected, OutOfSpace.spacey(input));
67+
}
68+
69+
@Test
70+
@Order(3)
71+
@DisplayName("Strings with letters, digits,")
72+
void test3() {
73+
String[] input = new String[]{"Trying!", "Adding2", "Diff3rent", "Comb1nati0ns"};
74+
String[] expected = new String[]{"Trying!", "Trying!Adding2", "Trying!Adding2Diff3rent", "Trying!Adding2Diff3rentComb1nati0ns"};
75+
Assertions.assertArrayEquals(expected, OutOfSpace.spacey(input));
76+
}
77+
78+
79+
}
80+
81+
*/

0 commit comments

Comments
 (0)
Please sign in to comment.