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
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. |
//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. | |
*/ |
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))) |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
void die(const char *message) | |
{ | |
if(errno) { | |
perror(message); | |
} else { |
Hey, | |
This is collection of small, interesting interview practice problems. | |
Hope you get some utility out of this. | |
Erik |
Problems can be found here: | |
https://gist.github.com/futureperfect/11016201 |
This is my first implementation of this String Calculator Code Kata.
It was written as TDD with Guard driving Minitest.
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.