Skip to content

Instantly share code, notes, and snippets.

View ogzhanolguncu's full-sized avatar
🎯
Focusing

Oğuzhan Olguncu ogzhanolguncu

🎯
Focusing
View GitHub Profile
@stealthbomber10
stealthbomber10 / stripe.py
Created October 10, 2018 19:01
stripe interview
from collections import defaultdict
import string
# You're running a pool of servers where the servers are numbered sequentially starting from 1. Over time, any given server might explode, in which case its server number is made available for reuse. When a new server is launched, it should be given the lowest available number.
# Write a function which, given the list of currently allocated server numbers, returns the number of the next server to allocate. In addition, you should demonstrate your approach to testing that your function is correct. You may choose to use an existing testing library for your language if you choose, or you may write your own process if you prefer.
# For example, your function should behave something like the following:
# >> next_server_number([5, 3, 1])

Virtual DOM and diffing algorithm

There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.

However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.