Skip to content
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
10 changes: 4 additions & 6 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@
# supported CodeQL languages.
#
---

name: CodeQL

permissions: read-all

on: # yamllint disable-line rule:truthy
push:
branches: ["main"]
branches: ['main']
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
branches: ['main']
workflow_dispatch:
schedule:
# ┌───────────── minute (0 - 59)
Expand All @@ -43,8 +42,7 @@ jobs:
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources
# for possible analysis time improvements.
runs-on:
${{ (matrix.language == 'swift' && 'macos-14') || 'ubuntu-24.04' }}
runs-on: ${{ (matrix.language == 'swift' && 'macos-14') || 'ubuntu-24.04' }}
permissions:
# required for all workflows
security-events: write
Expand Down Expand Up @@ -106,7 +104,7 @@ jobs:

- run: |
echo Run, Build Application using script
./gradlew build
./gradlew build -x checkstyleMain checkstyleTest

# - run: |
# echo Run, Build Application using script
Expand Down
19 changes: 9 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "automatic",
"java.checkstyle.configuration": "${workspaceFolder}/checkstyle.xml",
"java.checkstyle.version": "10.10.0",
"sonarlint.connectedMode.project": {
"connectionId": "sir-gon",
"projectKey": "sir-gon_algorithm-exercises-java"
},
"snyk.advanced.additionalParameters": "--exclude=.trunk,algorithm-exercises-java/build/reports"
}
"java.configuration.updateBuildConfiguration": "automatic",
"java.checkstyle.configuration": "${workspaceFolder}/checkstyle.xml",
"java.checkstyle.version": "10.10.0",
"sonarlint.connectedMode.project": {
"connectionId": "sir-gon",
"projectKey": "sir-gon_algorithm-exercises-java"
},
"snyk.advanced.additionalParameters": "--exclude=.trunk,algorithm-exercises-java/build/reports"
}
6 changes: 3 additions & 3 deletions algorithm-exercises-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ dependencies {
implementation 'com.google.guava:guava:33.5.0-jre'

//
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.21.0'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.21'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.21.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.21.0'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.21'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.21.0'

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
Expand All @@ -19,7 +20,7 @@ public static class ArraysLeftRotationTestCase {
public List<Integer> expected;
}

List<ArraysLeftRotationTestCase> testCases;
private final List<ArraysLeftRotationTestCase> testCases = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -29,7 +30,8 @@ void setup() throws IOException {
"arrays",
"ctci_array_left_rotation.testcases.json");

this.testCases = JsonLoader.loadJson(path, ArraysLeftRotationTestCase.class);
this.testCases.clear();
this.testCases.addAll(JsonLoader.loadJson(path, ArraysLeftRotationTestCase.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -20,7 +21,7 @@ public static class CrushBruteForceTestCase {
public long expected;
}

List<CrushBruteForceTestCase> testCases;
private final List<CrushBruteForceTestCase> testCases = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -29,7 +30,8 @@ void setup() throws IOException {
"interview_preparation_kit",
"arrays",
"crush.testcases.json");
this.testCases = JsonLoader.loadJson(path, CrushBruteForceTestCase.class);
this.testCases.clear();
this.testCases.addAll(JsonLoader.loadJson(path, CrushBruteForceTestCase.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -20,7 +21,7 @@ public static class CrushTestCase {
public long expected;
}

List<CrushTestCase> testCases;
private final List<CrushTestCase> testCases = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -29,7 +30,8 @@ void setup() throws IOException {
"arrays",
"crush.testcases.json");

this.testCases = JsonLoader.loadJson(path, CrushTestCase.class);
this.testCases.clear();
this.testCases.addAll(JsonLoader.loadJson(path, CrushTestCase.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -19,7 +20,7 @@ public static class MinimumSwaps2TestCase {
public long expected;
}

List<MinimumSwaps2TestCase> testCases;
private final List<MinimumSwaps2TestCase> testCases = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -28,7 +29,8 @@ void setup() throws IOException {
"arrays",
"minimum_swaps_2.testcases.json");

this.testCases = JsonLoader.loadJson(path, MinimumSwaps2TestCase.class);
this.testCases.clear();
this.testCases.addAll(JsonLoader.loadJson(path, MinimumSwaps2TestCase.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -19,7 +20,7 @@ public static class NewYearChaosTestCase {
public String expected;
}

List<NewYearChaosTestCase> testCases;
private final List<NewYearChaosTestCase> testCases = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -29,7 +30,8 @@ void setup() throws IOException {
"arrays",
"new_year_chaos.testcases.json");

this.testCases = JsonLoader.loadJson(path, NewYearChaosTestCase.class);
this.testCases.clear();
this.testCases.addAll(JsonLoader.loadJson(path, NewYearChaosTestCase.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class TwoDarrayTestCase {
public long expected;
}

private List<TwoDarrayTestCase> testCases;
private final List<TwoDarrayTestCase> testCases = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -29,7 +29,8 @@ void setup() throws IOException {
"arrays",
"2d_array.testcases.json");

this.testCases = JsonLoader.loadJson(path, TwoDarrayTestCase.class);
this.testCases.clear();
this.testCases.addAll(JsonLoader.loadJson(path, TwoDarrayTestCase.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -22,7 +23,7 @@ public static class CountTripletsBruteForceTestCase {
public Long expected;
}

private List<CountTripletsBruteForceTestCase> smallTestCases;
private final List<CountTripletsBruteForceTestCase> smallTestCases = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -33,7 +34,8 @@ void setup() throws IOException {
"dictionaries_and_hashmaps",
"count_triplets_1.small.testcases.json");

this.smallTestCases = JsonLoader.loadJson(path, CountTripletsBruteForceTestCase.class);
this.smallTestCases.clear();
this.smallTestCases.addAll(JsonLoader.loadJson(path, CountTripletsBruteForceTestCase.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -22,8 +23,8 @@ public static class CountTripletsTestCase {
public Long expected;
}

private List<CountTripletsTestCase> smallTestCases;
private List<CountTripletsTestCase> bigTestCases;
private final List<CountTripletsTestCase> smallTestCases = new ArrayList<>();
private final List<CountTripletsTestCase> bigTestCases = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -34,15 +35,17 @@ void setup() throws IOException {
"dictionaries_and_hashmaps",
"count_triplets_1.small.testcases.json");

this.smallTestCases = JsonLoader.loadJson(path, CountTripletsTestCase.class);
this.smallTestCases.clear();
this.smallTestCases.addAll(JsonLoader.loadJson(path, CountTripletsTestCase.class));

path = String.join("/",
"hackerrank",
"interview_preparation_kit",
"dictionaries_and_hashmaps",
"count_triplets_1.big.testcases.json");

this.bigTestCases = JsonLoader.loadJson(path, CountTripletsTestCase.class);
this.bigTestCases.clear();
this.bigTestCases.addAll(JsonLoader.loadJson(path, CountTripletsTestCase.class));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -21,10 +22,10 @@ public static class FrequencyQueriesTestCase {
public List<Integer> expected;
}

List<FrequencyQueriesTestCase> testCases;
List<FrequencyQueriesTestCase> testCase6;
List<FrequencyQueriesTestCase> testCaseBorderCases;
List<FrequencyQueriesTestCase> testCaseBorderCaseException;
private final List<FrequencyQueriesTestCase> testCases = new ArrayList<>();
private final List<FrequencyQueriesTestCase> testCase6 = new ArrayList<>();
private final List<FrequencyQueriesTestCase> testCaseBorderCases = new ArrayList<>();
private final List<FrequencyQueriesTestCase> testCaseBorderCaseException = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -35,28 +36,33 @@ void setup() throws IOException {
"dictionaries_and_hashmaps",
"frequency_queries.testcases.json");

this.testCases = JsonLoader.loadJson(path, FrequencyQueriesTestCase.class);
this.testCases.clear();
this.testCases.addAll(JsonLoader.loadJson(path, FrequencyQueriesTestCase.class));

path = String.join("/",
"hackerrank",
"interview_preparation_kit",
"dictionaries_and_hashmaps",
"frequency_queries.testcase6.json");
this.testCase6 = JsonLoader.loadJson(path, FrequencyQueriesTestCase.class);
this.testCase6.clear();
this.testCase6.addAll(JsonLoader.loadJson(path, FrequencyQueriesTestCase.class));

path = String.join("/",
"hackerrank",
"interview_preparation_kit",
"dictionaries_and_hashmaps",
"frequency_queries.testcase_border_cases.json");
this.testCaseBorderCases = JsonLoader.loadJson(path, FrequencyQueriesTestCase.class);
"hackerrank",
"interview_preparation_kit",
"dictionaries_and_hashmaps",
"frequency_queries.testcase_border_cases.json");
this.testCaseBorderCases.clear();
this.testCaseBorderCases.addAll(JsonLoader.loadJson(path, FrequencyQueriesTestCase.class));

path = String.join("/",
"hackerrank",
"interview_preparation_kit",
"dictionaries_and_hashmaps",
"frequency_queries.testcase_border_case_exception.json");
this.testCaseBorderCaseException = JsonLoader.loadJson(path, FrequencyQueriesTestCase.class);
"hackerrank",
"interview_preparation_kit",
"dictionaries_and_hashmaps",
"frequency_queries.testcase_border_case_exception.json");
this.testCaseBorderCaseException.clear();
this.testCaseBorderCaseException.addAll(
JsonLoader.loadJson(path, FrequencyQueriesTestCase.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -20,7 +21,7 @@ public static class RansomNoteTestCase {
public String expected;
}

List<RansomNoteTestCase> testCases;
private final List<RansomNoteTestCase> testCases = new ArrayList<>();

@BeforeAll
void setup() throws IOException {
Expand All @@ -29,7 +30,8 @@ void setup() throws IOException {
"dictionaries_and_hashmaps",
"ctci_ransom_note.testcases.json");

this.testCases = JsonLoader.loadJson(path, RansomNoteTestCase.class);
this.testCases.clear();
this.testCases.addAll(JsonLoader.loadJson(path, RansomNoteTestCase.class));
}

@Test
Expand Down
Loading
Loading