Skip to content

Working #19

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

Merged
merged 2 commits into from
Mar 19, 2024
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
7 changes: 7 additions & 0 deletions My Solutions/082_ Running out of space/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}
18 changes: 18 additions & 0 deletions My Solutions/082_ Running out of space/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Getting Started

Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.

## Folder Structure

The workspace contains two folders by default, where:

- `src`: the folder to maintain sources
- `lib`: the folder to maintain dependencies

Meanwhile, the compiled output files will be generated in the `bin` folder by default.

> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
## Dependency Management

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).
Binary file not shown.
81 changes: 81 additions & 0 deletions My Solutions/082_ Running out of space/src/OutOfSpace.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* Codewars Coding Challenge

Day 82/366

Level 7kyu

Running out of space

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.
For example, running this function on the array ['i', 'have','no','space'] would produce ['i','ihave','ihaveno','ihavenospace']


public class OutOfSpace {

public static String[] spacey(String[] array) {
// TODO: Figure it out :)
return null;
}

}


https://www.codewars.com/kata/56576f82ab83ee8268000059/train/java
*
*
*/

public class OutOfSpace {
public static String[] spacey(String[] array) {
String[] result = new String[array.length];
String noSpace = "";
for (int i = 0; i < array.length; i++) {
noSpace += array[i];
result[i] = noSpace;
}
return result;
}
}


/*
* Sample Tests
*
*
* import java.util.Arrays;
import org.junit.jupiter.api.*;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class SolutionTest {

@Test
@Order(1)
@DisplayName("Strings with lower letters only")
void test1() {
String[] input = new String[]{"kevin", "has", "no", "space"};
String[] expected = new String[]{"kevin", "kevinhas", "kevinhasno", "kevinhasnospace"};
Assertions.assertArrayEquals(expected, OutOfSpace.spacey(input));
}

@Test
@Order(2)
@DisplayName("Strings with camel case")
void test2() {
String[] input = new String[]{"Camel", "Case", "Should", "Remain"};
String[] expected = new String[]{"Camel", "CamelCase", "CamelCaseShould", "CamelCaseShouldRemain"};
Assertions.assertArrayEquals(expected, OutOfSpace.spacey(input));
}

@Test
@Order(3)
@DisplayName("Strings with letters, digits,")
void test3() {
String[] input = new String[]{"Trying!", "Adding2", "Diff3rent", "Comb1nati0ns"};
String[] expected = new String[]{"Trying!", "Trying!Adding2", "Trying!Adding2Diff3rent", "Trying!Adding2Diff3rentComb1nati0ns"};
Assertions.assertArrayEquals(expected, OutOfSpace.spacey(input));
}


}

*/