Skip to content

Instantly share code, notes, and snippets.

@zantetsuken88
zantetsuken88 / Matrix.java
Last active Oct 22, 2018
exercism/java/matrix
View Matrix.java
class Matrix {
private int[][] matrixAsArray;
Matrix(String matrixAsString) {
this.matrixAsArray = convertToArray(matrixAsString);
}
int[] getRow(int rowNumber) {
return matrixAsArray[rowNumber];
View Scrabble.java
import java.util.HashMap;
import java.util.List;
class Scrabble {
private static final HashMap<Character, Integer> SCORE_MAP = new HashMap<Character, Integer>() {{
put('a', 1);
put('b', 3);
put('c', 3);
put('d', 2);
put('e', 1);
View Proverb.java
class Proverb {
private String[] words;
Proverb(String[] words) {
this.words = words;
}
String recite() {
View Acronym.java
class Acronym {
private final String phrase;
Acronym(String phrase) {
this.phrase = phrase;
}
String get() {
String[] words = phrase.split("\\W+");
View SpaceAge.java
class SpaceAge {
private static final double EARTH_SECONDS = 31557600;
private static final double MERCURY_ORBIT = 0.2408467;
private static final double VENUS_ORBIT = 0.61519726;
private static final double MARS_ORBIT = 1.8808158;
private static final double JUPITER_ORBIT = 11.862615;
private static final double SATURN_ORBIT = 29.447498;
private static final double URANUS_ORBIT = 84.016846;
private static final double NEPTUNE_ORBIT = 164.79132;
View HammingDistance.java
class Hamming {
private String leftStrand;
private String rightStrand;
Hamming(String leftStrand, String rightStrand) {
this.leftStrand = leftStrand;
this.rightStrand = rightStrand;
if (leftStrand.length() != rightStrand.length()) {
throw new IllegalArgumentException("leftStrand and rightStrand must be of equal length.");
View keybase.md

Keybase proof

I hereby claim:

  • I am zantetsuken88 on github.
  • I am zantetsuken88 (https://keybase.io/zantetsuken88) on keybase.
  • I have a public key ASAmXJrtNloih9gxR12mGA-Ju2GUvcaI54Q5eElv5iQ9yAo

To claim this, I am signing this object: