Skip to content

Instantly share code, notes, and snippets.

View laflechejonathan's full-sized avatar

Jonathan Lafleche laflechejonathan

View GitHub Profile
from collections import defaultdict
class FirstUnique:
def __init__(self, nums: List[int]):
self.num_counts = defaultdict(lambda: 0)
for num in nums:
self.num_counts[num] += 1
self.ordered_nums = [num for num in nums if self.num_counts[num] == 1]

Keybase proof

I hereby claim:

  • I am laflechejonathan on github.
  • I am jlf (https://keybase.io/jlf) on keybase.
  • I have a public key whose fingerprint is 9A09 9CFC A50D A156 E297 BE43 CE24 C64E 9458 2F3C

To claim this, I am signing this object:

class Solution(object):
def allDirections(self, x, y):
for d_x, d_y in [(0, 1), (0, -1), (1, 0), (-1, 0)]:
new_x = x + d_x
new_y = y + d_y
if (
new_x >= 0 and
new_x < self.width and
new_y >= 0 and
"""
└──foo
└──tests
└──test_integration
└──FooTest
├──testFooBar123
├──testBlahBlahSecrets
"""
(y - y % 8) * 16 + x = ((y / 8) * 128) + x
# eliminate x, useless
# divide 16 both sides
(y - y % 8) = (y / 8) * 8
# hard to show this equality with algebra since it relies on int math, let's look at examples
(y - y % 8) = (y / 8) * 8
y = 27
27 - 27 % 8 = 27 - 3 = 24
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkedList:
def __init__(self):
import random
class Node(object):
def __init__(self, value):
self.value = value
self.next = None
@classmethod
def from_list(cls, l):
head = None
@laflechejonathan
laflechejonathan / services.md
Last active July 15, 2016 19:21
List of services I'd use at a startup
### Keybase proof
I hereby claim:
* I am laflechejonathan on github.
* I am jlf (https://keybase.io/jlf) on keybase.
* I have a public key whose fingerprint is 1D4F D423 68A9 1EB5 13A5 0147 6349 D9DA 4A10 F0B8
To claim this, I am signing this object: