Skip to content

Instantly share code, notes, and snippets.

from collections import Counter
size = 11
tab = [None] * size*size
def split(t):
return [t[size*i:size*i+size] for i in range(size)]
def splitV(t):
@smaspe
smaspe / codeeval_asciidescription.py
Last active January 12, 2016 22:03
A code eval challenge solved some other way
# A side-step solution because I was too lazy to find the repeated word...
# It find the most common letter, but exclude ' ', which is the lowest value and is often more common than 'e'
import sys
from collections import Counter
with open(sys.argv[1], 'r') as test_cases:
for test in test_cases:
vals = map(int, test.split('|')[2].strip().split(' '))
m = min(vals)
e = Counter(v for v in vals if v != m).most_common(1)[0][0]
@smaspe
smaspe / heapsort.py
Created July 11, 2017 02:29
A quick implementation of heapsort
parent_index = lambda x: (x - 1) / 2
left_child_index = lambda x: 2 * x + 1
def heapsort(arr):
"""
sorts the given list using heapsort
"""
heapify(arr)
print_heap(arr)
sort_heap(arr)
# Java Maven CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk