Skip to content

Instantly share code, notes, and snippets.

@snarkbait
snarkbait / Direction.java
Created November 29, 2017 08:07
Direction enum class - Advent of Code helper
package util;
/**
* @author /u/Philboyd_Studge on 12/26/2016.
*
* This enum set is for simplifying movement on a 2d integer grid
* Assuming the Y axis is -up(north) and +down(south),
* and X axis is -right(west) and +left(east)
*/
public enum Direction {
@snarkbait
snarkbait / FileIO.java
Created November 30, 2017 07:15
FileIO
package util;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@snarkbait
snarkbait / Permutations.java
Created November 30, 2017 07:36
Advent of Code helper - Permutations
package util;
import java.util.ArrayList;
import java.util.List;
/**
* @author /u/Philboyd_Studge on 12/26/2016.
*/
public class Permutations {
@snarkbait
snarkbait / Tuple2.java
Created December 1, 2017 02:29
Tuple2
package util;
import java.util.ArrayList;
import java.util.List;
/**
* @author /u/Philboyd_Studge on 3/19/2017.
*/
public class Tuple2<T, U> {
protected final T t;
@snarkbait
snarkbait / Tuple3.java
Created December 1, 2017 02:31
Tuple3
package util;
/**
* @author /u/Philboyd_Studge on 3/19/2017.
*/
public class Tuple3<T, U, V> extends Tuple2<T, U> {
private final V v;
public Tuple3(T t, U u, V v) {
super(t, u);
@snarkbait
snarkbait / Day1.java
Last active December 1, 2017 06:03
Advent of Code 2017 Day 1
package Advent2017;
import util.FileIO;
import util.Timer;
/**
* @author /u/Philboyd_Studge
*/
public class Day1 {
@snarkbait
snarkbait / Day2.java
Created December 2, 2017 05:29
Advent of Code 2017 Day 2
package Advent2017;
import util.ArrayUtils;
import util.FileIO;
import java.util.Arrays;
public class Day2 {
@snarkbait
snarkbait / Day3.java
Last active December 3, 2017 23:11
Advent of Code 2017 - Day 3
package Advent2017;
import util.Direction;
import util.Node;
import util.Timer;
import java.util.*;
public class Day3 {
@snarkbait
snarkbait / Day4.java
Created December 4, 2017 05:28
Advent of Code 2017 - Day 4
package Advent2017;
import util.FileIO;
import util.Timer;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@snarkbait
snarkbait / Day5.java
Last active December 5, 2017 06:15
Advent of Code 2017 Day 5
package Advent2017;
import util.FileIO;
import java.util.List;
public class Day5 {
private static int part1(int[] nums) {
int current = 0;