Solution to Square online technical challenge