Skip to content

Instantly share code, notes, and snippets.

View yixizhang's full-sized avatar

Yixi Zhang yixizhang

  • bay area
View GitHub Profile
@yixizhang
yixizhang / sort string
Last active October 12, 2015 20:48
sort strings by numeric char number
#!/usr/bin/env python -*- coding: utf-8 -*-
import re
import unittest
def least_numeric(strings):
return min(strings, key=lambda s: len(re.findall(r'\d', s)))
class TestLeastNumeric(unittest.TestCase):
def test1(self):
@yixizhang
yixizhang / word_jumble.py
Last active October 12, 2015 04:47
engineering challenge @ twice
#!/usr/bin/env python -*- coding: utf-8 -*-
import sys
import itertools
f = open('dictionary.txt')
dictionary = [w.strip() for w in f.readlines()]
f.close()
def jumble(word):