Skip to content

Instantly share code, notes, and snippets.

View futureperfect's full-sized avatar

Erik Hollembeak futureperfect

View GitHub Profile
@futureperfect
futureperfect / CircularArrays.java
Created September 5, 2013 03:29
Determine whether an array is "circular".
package io.tense.interview.arrays;
import static com.google.common.base.Preconditions.checkNotNull;
public class CircularArrays {
/**
* Tests for the the complete "circularity" of an array of integers where
* traversal is performed by taking array[i] and summing the index i and
* value stored in the array to derive a new index.
@futureperfect
futureperfect / find-mode-in-array.txt
Created October 14, 2013 20:11
Find the mode of a sorted array of integers
//Find mode in sorted array
/*
What types? Let's assume int for now.
Bounds on underlying data? No bounds beyond underlying int type
Know anything about the distribution. Nope. Anything and everything, but the array is monotonically increasing.
What bounds on array size? Let's not concern ourselves. Sufficiently
small that we can work with the array in memory.
*/
@futureperfect
futureperfect / FindInBST.java
Last active December 25, 2015 13:09
Find a value within a binary search tree
public class FindInBST {
public static Node<T> findValueInBST(T value, Node<T> root) {
checkNotNull(value);
//terminating condition
if (root == null) {
return null;
}
;; Author: Erik Hollembeak
;;
(defun test-gamegrid-nonsense ()
"Test out using gamegrid for rendering 2D ASCII world"
(require 'cl)
(require 'gamegrid)
(loop for x from 33 to 57 do
(gamegrid-init-buffer 24 24 x)
(sit-for 0.4)))
@futureperfect
futureperfect / extensible_sort.c
Created February 3, 2014 22:55
C command line list sorting w/ sort function extensibility and comparator extensibility
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
void die(const char *message)
{
if(errno) {
perror(message);
} else {
@futureperfect
futureperfect / README
Last active September 4, 2019 03:16
Collection of small, interesting programming exercises
Hey,
This is collection of small, interesting interview practice problems.
Hope you get some utility out of this.
Erik
@futureperfect
futureperfect / README
Last active August 29, 2015 14:00
Answers for Gist located at practice programming problems gist
Problems can be found here:
https://gist.github.com/futureperfect/11016201
@futureperfect
futureperfect / Swift Exercises.md
Last active May 25, 2019 21:50
Swift Exercises

Swift Exercises

This is a collection of familiarization exercises in Swift. They'll suffer from ignorance of writing idiomatic code. My goal is to iterate on these as fluency develops and leave them up for the brave.

In short:

  • Caveat Lector
  • Don't Be A Jerk
@futureperfect
futureperfect / README.md
Created June 16, 2015 23:41
String Calculator Kata

String Calculator

This is my first implementation of this String Calculator Code Kata.

It was written as TDD with Guard driving Minitest.

@futureperfect
futureperfect / README.md
Last active August 29, 2015 14:23
Ruby Refactoring Exercise

Traffic Light Refactoring Exercise

The code contained in traffic_light.rb is a simple model for a traffic light. How can we refactor this? Pretend we have tests so we're actually refactoring and not just changing shit.

Note anything about what you observe in this code and how it drives your refactoring.