This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def interval_overlap(i1, i2): | |
| if i1.end >= i2.start: | |
| return True | |
| else: | |
| return False | |
| def merge_interval(i1, i2): | |
| return Interval(s=min(i1.start, i2.start), e=max(i1.end, i2.end)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://leetcode.com/problems/merge-k-sorted-lists/ | |
| # Definition for singly-linked list. | |
| class ListNode: | |
| def __init__(self, x): | |
| self.val = x | |
| self.next = None | |
| class Solution: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Definition for singly-linked list. | |
| class ListNode: | |
| def __init__(self, x): | |
| self.val = x | |
| self.next = None | |
| def list_to_stack(l): | |
| s = [] | |
| node = l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import defaultdict | |
| import random | |
| import string | |
| alphabet = string.ascii_letters + '0123456789' | |
| class Codec: | |
| def __init__(self): | |
| self.urls = defaultdict(str) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from concurrent import futures | |
| import requests | |
| URLS = {'BTC': 'https://api.gdax.com/products/BTC-USD/ticker', | |
| 'ETH': 'https://api.gdax.com/products/ETH-USD/ticker', | |
| 'LTC': 'https://api.gdax.com/products/LTC-USD/ticker'} | |
| def get_quote(toople): | |
| coin, url = toople |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $go_file = "go1.5.3.linux-amd64.tar.gz" | |
| $stupid_path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/vagrant_ruby/bin' | |
| $dot_profile = ' | |
| # ~/.profile: executed by the command interpreter for login shells. | |
| # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login | |
| # exists. | |
| # see /usr/share/doc/bash/examples/startup-files for examples. | |
| # the files are located in the bash-doc package. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # assume inputs are lists | |
| def merge1(words, more): | |
| sentence = "" | |
| for w in words: sentence += w | |
| for w in more: sentence += w | |
| return sentence | |
| def merge2(words, more): | |
| sentence = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node.force_override['java']['jdk_version'] = '7' | |
| include_recipe "java" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # showing java cookbook fail | |
| node.default[:java][:jdk_version] = '7' | |
| include_recipe 'java' | |
| =begin | |
| doesn't override this line: | |
| https://github.com/opscode-cookbooks/java/blob/master/attributes/default.rb#L46 | |
| I output some custom logging from the java cookbook at: | |
| https://github.com/opscode-cookbooks/java/blob/master/recipes/openjdk.rb#L47 | |
| [2013-08-26T21:57:17+00:00] INFO: java version 7 |