Skip to content

Commit

Permalink
chore: sync-up catalog (#682)
Browse files Browse the repository at this point in the history
* chore: sync-up catalog

- kata/counting-characters (beta => 8-kyu)
- kata/spacify (7-kyu => retired)
- kata/days-in-the-year (8-kyu => retired)
- kata/center-of-array (beta => retired)

* docs: sync progress

* refactor: limit class visibility to package-private
  • Loading branch information
ParanoidUser authored Oct 14, 2024
1 parent 3cbbb58 commit c200e1b
Show file tree
Hide file tree
Showing 32 changed files with 148 additions and 141 deletions.
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Codewars Handbook β˜•οΈπŸš€

[![Views statistics +1 πŸ‘€](https://img.shields.io/badge/dynamic/xml?color=success&label=views&query=//*[name()=%27text%27][3]&url=https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FParanoidUser%2Fcodewars-handbook)](https://hits.seeyoufarm.com/api/count/graph/dailyhits.svg?url=https://github.com/ParanoidUser/codewars-handbook)
[![Completed kata πŸ‘Œ](https://img.shields.io/badge/completed%20kata-69.1%25-red.svg)](https://www.codewars.com/kata/search/java?xids=completed)
[![Completed kata πŸ‘Œ](https://img.shields.io/badge/completed%20kata-68.9%25-red.svg)](https://www.codewars.com/kata/search/java?xids=completed)
[![CI pipeline πŸ› ](https://img.shields.io/github/actions/workflow/status/ParanoidUser/codewars-handbook/build.yml?branch=main)](https://github.com/ParanoidUser/codewars-handbook/actions/workflows/build.yml)
[![Quality gate πŸ”Ž](https://img.shields.io/sonar/alert_status/codewars-handbook?server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=codewars-handbook)
[![Let's have a chat! πŸ“ž](https://img.shields.io/gitter/room/ParanoidUser/codewars-handbook?color=49c39e)](https://gitter.im/ParanoidUser/codewars-handbook)
Expand All @@ -25,7 +25,7 @@ slug.

| [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) |
|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:---------------------------:|:---------------------------------:|
| 0 | 1 | 2 | 26 | 48 | 433 | 591 | 219 | 56 | 79 |
| 0 | 1 | 2 | 26 | 48 | 433 | 590 | 219 | 54 | 82 |

**Note:** The source code is written in Java 17 and may use language features that are incompatible
with Java 8, 11.
Expand Down
214 changes: 107 additions & 107 deletions kata/6-kyu/code-breaking-by-letter-frequency/test/SampleTest.java

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions kata/6-kyu/guess-the-number-1/main/Guesser.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public class Guesser {
class Guesser {
private int guesses = 0;
private Integer num;

Expand Down Expand Up @@ -33,9 +33,9 @@ final void setAnswer(int answer) {
}

@SuppressWarnings("serial")
public static class GameException extends RuntimeException {
static class GameException extends RuntimeException {
public GameException(String msg) {
super(msg);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import java.util.HashSet;
import java.util.Set;

public class PhotoManager {
class PhotoManager {
private final Set<String> names = new HashSet<>();

boolean nameExists(String name) {
Expand Down
2 changes: 1 addition & 1 deletion kata/6-kyu/reverse-or-rotate/main/RevRot.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static String revRot(String strng, int sz) {
for (var i = 0; i <= strng.length() - sz; i += sz) {
var chunk = new StringBuilder(strng.substring(i, sz + i));
if (range(0, sz).mapToDouble(j -> Math.pow(chunk.charAt(j) - 48., 3)).sum() % 2 > 0) {
result.append(chunk.substring(1, sz)).append(chunk.charAt(0));
result.append(chunk, 1, sz).append(chunk.charAt(0));
} else {
result.append(chunk.reverse());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Student {
private final String department;
private final Gender gender;

public enum Gender {
enum Gender {
MALE, FEMALE
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
public class InvalidPlugboardWiresException extends Exception
{
}
class InvalidPlugboardWiresException extends Exception {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
public final class SimpleInteger implements Comparable<SimpleInteger> {
final class SimpleInteger implements Comparable<SimpleInteger> {
private final int value;

public SimpleInteger(int val) {
SimpleInteger(int val) {
value = val;
}

Expand Down Expand Up @@ -37,4 +37,4 @@ public boolean equals(Object obj) {
public int hashCode() {
return value ^ ((value + 1) * 31) * 31;
}
}
}
4 changes: 2 additions & 2 deletions kata/7-kyu/fixme-run-runner/main/ThreadUtil.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public final class ThreadUtil {
final class ThreadUtil {

private ThreadUtil() {}

Expand All @@ -12,4 +12,4 @@ static void method1() {
static void method2() {
id2 = Thread.currentThread().getId();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import lombok.AllArgsConstructor;

@AllArgsConstructor
public class Vector3D {
class Vector3D {
final double x;
final double y;
final double z;
}
}
1 change: 0 additions & 1 deletion kata/7-kyu/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@
- [Sort the Gift Code](sort-the-gift-code)
- [Sorted? yes? no? how?](sorted-yes-no-how)
- [Sorting the Odd way!](sorting-the-odd-way)
- [Spacify](spacify)
- [Special Number (Special Numbers Series #5)](special-number-special-numbers-series-number-5)
- [Speed Control](speed-control)
- [Speed Limit](speed-limit)
Expand Down
5 changes: 2 additions & 3 deletions kata/7-kyu/scrabble-score/main/ScoreBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ScoreBoard {

class ScoreBoard {
private static final Map<Character, Integer> SCORE = Map.ofEntries(
entry('E', 1),
entry('A', 1),
Expand Down Expand Up @@ -36,7 +35,7 @@ public class ScoreBoard {
entry('Z', 10)
);

public static int getScore(char c) {
static int getScore(char c) {
return SCORE.get(c);
}
}
4 changes: 2 additions & 2 deletions kata/7-kyu/where-is-thb/main/THB.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class THB {
String testing(String initial) {
static String testing(String initial) {
return initial != null ? initial.replaceAll("[^tThHbB]", "") : "";
}
}
}
10 changes: 10 additions & 0 deletions kata/7-kyu/where-is-thb/test/THBTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

class THBTest {
@Test
void sample() {
assertEquals("thhttttbbttt", THB.testing("For those of you who would like to test your solution before submitting it."));
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion kata/8-kyu/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
- [Count Odd Numbers below n](count-odd-numbers-below-n)
- [Count of positives / sum of negatives](count-of-positives-slash-sum-of-negatives)
- [Count the Monkeys!](count-the-monkeys)
- [Counting Characters](counting-characters)
- [Counting sheep...](counting-sheep-dot-dot-dot)
- [CSV representation of array](csv-representation-of-array)
# D
- [Days in the year](days-in-the-year)
- [Determine offspring sex based on genes XX and XY chromosomes](determine-offspring-sex-based-on-genes-xx-and-xy-chromosomes)
- [Did she say hallo?](did-she-say-hallo)
- [Difference of Volumes of Cuboids](difference-of-volumes-of-cuboids)
Expand Down
2 changes: 0 additions & 2 deletions kata/beta/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
- [Brackets Checker](brackets-checker)
# C
- [CaMeLcAsInG](camelcasing)
- [Center of Array](center-of-array)
- [Change for pizza](change-for-pizza)
- [Check the tire pressure](check-the-tire-pressure)
- [Consecutive Sum](consecutive-sum)
- [Convert natural number to its binary representation](convert-natural-number-to-its-binary-representation)
- [Count the likes](count-the-likes)
- [Counting Characters](counting-characters)
# D
- [Decoding a logic transmission](decoding-a-logic-transmission)
- [Divisible by 9?](divisible-by-9)
Expand Down
3 changes: 1 addition & 2 deletions kata/beta/tinder-for-programmers/main/Action.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@FunctionalInterface
public interface Action {
interface Action {
void execute();
}
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions kata/retired/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# C
- [Calculator](calculator)
- [Carbon Dating](carbon-dating)
- [Center of Array](center-of-array)
- [Checking Groups](checking-groups)
- [Collatz conjecture counter for big numbers](collatz-conjecture-counter-for-big-numbers)
- [Convert your name to Japanese! (Game)](convert-your-name-to-japanese-game)
Expand All @@ -20,6 +21,7 @@
- [Counting power sets](counting-power-sets)
- [CubeSummation](cubesummation)
# D
- [Days in the year](days-in-the-year)
- [Dubstep](dubstep)
# F
- [Filter Map Sort Practice](filter-map-sort-practice)
Expand Down Expand Up @@ -70,6 +72,7 @@
- [Signal Generator](signal-generator)
- [Simple transposition](simple-transposition)
- [Simplified Nim - AI](simplified-nim-ai)
- [Spacify](spacify)
- [Squash the bugs](squash-the-bugs)
- [Stop Donald Trump (2015)](stop-donald-trump-2015)
- [String Product](string-product)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
Expand Down
8 changes: 4 additions & 4 deletions kata/retired/multiline-string-maker/test/MultilineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ void fixedTest1() {

@Test
void fixedTest2() {
String c = "String a=\"public class Cake\\n\"+\n\"{\\n\"+\n\" private double price;\\n\"+\n\" private String color;\\n\"+\n\" public Cake(double price, String color)\\n\"+\n\" {\\n\"+\n\" this.price=price;\\n\"+\n\" this.color=color;\\n\"+\n\" }\\n\"+\n\" public double getPrice()\\n\"+\n\" {\\n\"+\n\" return price;\\n\"+\n\" }\\n\"+\n\" public void setPrice(double price)\\n\"+\n\" {\\n\"+\n\" this.price=price;\\n\"+\n\" }\\n\"+\n\" public String getColor()\\n\"+\n\" {\\n\"+\n\" return color;\\n\"+\n\" }\\n\"+\n\" public void setColor(String color)\\n\"+\n\" {\\n\"+\n\" this.color=color;\\n\"+\n\" }\\n\"+\n\" public String toString()\\n\"+\n\" {\\n\"+\n\" return \\\"Price: \\\"+price+\\\"\\\\n\\\"\\n\"+\n\" +\\\"Color: \\\"+color;\\n\"+\n\" }\\n\"+\n\"}\";";
assertEquals(c, MultilineMaker.make("a", "public class Cake\n{\n private double price;\n private String color;\n public Cake(double price, String color)\n {\n this.price=price;\n this.color=color;\n }\n public double getPrice()\n {\n return price;\n }\n public void setPrice(double price)\n {\n this.price=price;\n }\n public String getColor()\n {\n return color;\n }\n public void setColor(String color)\n {\n this.color=color;\n }\n public String toString()\n {\n return \"Price: \"+price+\"\\n\"\n +\"Color: \"+color;\n }\n}"));
String c = "String a=\"class Cake\\n\"+\n\"{\\n\"+\n\" private double price;\\n\"+\n\" private String color;\\n\"+\n\" public Cake(double price, String color)\\n\"+\n\" {\\n\"+\n\" this.price=price;\\n\"+\n\" this.color=color;\\n\"+\n\" }\\n\"+\n\" public double getPrice()\\n\"+\n\" {\\n\"+\n\" return price;\\n\"+\n\" }\\n\"+\n\" public void setPrice(double price)\\n\"+\n\" {\\n\"+\n\" this.price=price;\\n\"+\n\" }\\n\"+\n\" public String getColor()\\n\"+\n\" {\\n\"+\n\" return color;\\n\"+\n\" }\\n\"+\n\" public void setColor(String color)\\n\"+\n\" {\\n\"+\n\" this.color=color;\\n\"+\n\" }\\n\"+\n\" public String toString()\\n\"+\n\" {\\n\"+\n\" return \\\"Price: \\\"+price+\\\"\\\\n\\\"\\n\"+\n\" +\\\"Color: \\\"+color;\\n\"+\n\" }\\n\"+\n\"}\";";
assertEquals(c, MultilineMaker.make("a", "class Cake\n{\n private double price;\n private String color;\n public Cake(double price, String color)\n {\n this.price=price;\n this.color=color;\n }\n public double getPrice()\n {\n return price;\n }\n public void setPrice(double price)\n {\n this.price=price;\n }\n public String getColor()\n {\n return color;\n }\n public void setColor(String color)\n {\n this.color=color;\n }\n public String toString()\n {\n return \"Price: \"+price+\"\\n\"\n +\"Color: \"+color;\n }\n}"));
}

@Test
void fixedTest3() {
String c = "String a=\"public class ID\\n\"+\n\"{\\n\"+\n\" private String name;\\n\"+\n\" private int idNumber;\\n\"+\n\" private boolean expired;\\n\"+\n\" public ID(String name, int idNumber, boolean expired)\\n\"+\n\" {\\n\"+\n\" this.name=name;\\n\"+\n\" this.idNumber=idNumber;\\n\"+\n\" this.expired=expired;\\n\"+\n\" }\\n\"+\n\" public String getName()\\n\"+\n\" {\\n\"+\n\" return name;\\n\"+\n\" }\\n\"+\n\" public void setName(String name)\\n\"+\n\" {\\n\"+\n\" this.name=name;\\n\"+\n\" }\\n\"+\n\" public int getIdNumber()\\n\"+\n\" {\\n\"+\n\" return idNumber;\\n\"+\n\" }\\n\"+\n\" public void setIdNumber(int idNumber)\\n\"+\n\" {\\n\"+\n\" this.idNumber=idNumber;\\n\"+\n\" }\\n\"+\n\" public boolean getExpired()\\n\"+\n\" {\\n\"+\n\" return expired;\\n\"+\n\" }\\n\"+\n\" public void setExpired(boolean expired)\\n\"+\n\" {\\n\"+\n\" this.expired=expired;\\n\"+\n\" }\\n\"+\n\" public String toString()\\n\"+\n\" {\\n\"+\n\" return \\\"Name: \\\"+name+\\\"\\\\n\\\"\\n\"+\n\" +\\\"Id Number: \\\"+idNumber+\\\"\\\\n\\\"\\n\"+\n\" +\\\"Expired: \\\"+expired;\\n\"+\n\" }\\n\"+\n\"}\";";
assertEquals(c, MultilineMaker.make("a", "public class ID\n{\n private String name;\n private int idNumber;\n private boolean expired;\n public ID(String name, int idNumber, boolean expired)\n {\n this.name=name;\n this.idNumber=idNumber;\n this.expired=expired;\n }\n public String getName()\n {\n return name;\n }\n public void setName(String name)\n {\n this.name=name;\n }\n public int getIdNumber()\n {\n return idNumber;\n }\n public void setIdNumber(int idNumber)\n {\n this.idNumber=idNumber;\n }\n public boolean getExpired()\n {\n return expired;\n }\n public void setExpired(boolean expired)\n {\n this.expired=expired;\n }\n public String toString()\n {\n return \"Name: \"+name+\"\\n\"\n +\"Id Number: \"+idNumber+\"\\n\"\n +\"Expired: \"+expired;\n }\n}"));
String c = "String a=\"class ID\\n\"+\n\"{\\n\"+\n\" private String name;\\n\"+\n\" private int idNumber;\\n\"+\n\" private boolean expired;\\n\"+\n\" public ID(String name, int idNumber, boolean expired)\\n\"+\n\" {\\n\"+\n\" this.name=name;\\n\"+\n\" this.idNumber=idNumber;\\n\"+\n\" this.expired=expired;\\n\"+\n\" }\\n\"+\n\" public String getName()\\n\"+\n\" {\\n\"+\n\" return name;\\n\"+\n\" }\\n\"+\n\" public void setName(String name)\\n\"+\n\" {\\n\"+\n\" this.name=name;\\n\"+\n\" }\\n\"+\n\" public int getIdNumber()\\n\"+\n\" {\\n\"+\n\" return idNumber;\\n\"+\n\" }\\n\"+\n\" public void setIdNumber(int idNumber)\\n\"+\n\" {\\n\"+\n\" this.idNumber=idNumber;\\n\"+\n\" }\\n\"+\n\" public boolean getExpired()\\n\"+\n\" {\\n\"+\n\" return expired;\\n\"+\n\" }\\n\"+\n\" public void setExpired(boolean expired)\\n\"+\n\" {\\n\"+\n\" this.expired=expired;\\n\"+\n\" }\\n\"+\n\" public String toString()\\n\"+\n\" {\\n\"+\n\" return \\\"Name: \\\"+name+\\\"\\\\n\\\"\\n\"+\n\" +\\\"Id Number: \\\"+idNumber+\\\"\\\\n\\\"\\n\"+\n\" +\\\"Expired: \\\"+expired;\\n\"+\n\" }\\n\"+\n\"}\";";
assertEquals(c, MultilineMaker.make("a", "class ID\n{\n private String name;\n private int idNumber;\n private boolean expired;\n public ID(String name, int idNumber, boolean expired)\n {\n this.name=name;\n this.idNumber=idNumber;\n this.expired=expired;\n }\n public String getName()\n {\n return name;\n }\n public void setName(String name)\n {\n this.name=name;\n }\n public int getIdNumber()\n {\n return idNumber;\n }\n public void setIdNumber(int idNumber)\n {\n this.idNumber=idNumber;\n }\n public boolean getExpired()\n {\n return expired;\n }\n public void setExpired(boolean expired)\n {\n this.expired=expired;\n }\n public String toString()\n {\n return \"Name: \"+name+\"\\n\"\n +\"Id Number: \"+idNumber+\"\\n\"\n +\"Expired: \"+expired;\n }\n}"));
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c200e1b

Please sign in to comment.