start new:
tmux
start new with session name:
tmux new -s myname
alias g='git' | |
alias gst='g status' | |
alias gfe='g fetch' | |
alias gco='g checkout' | |
alias gcd='gco develop' | |
alias gcm='gco master' |
from typing import List | |
class Permutation(object): | |
def permute(self, nums: List[int]) -> List[List[int]]: | |
def dfs(nums, permute, result): | |
if not nums: | |
result.append(permute) | |
return | |
for j, x in enumerate(nums): | |
dfs(nums[:j] + nums[j+1:], permute + [nums[j]], result) |
class NumberCombination(object): | |
def number_combination(self, nums): | |
result = [] | |
tracker = [] | |
for x in nums: | |
for i in range(1,3): | |
if self.__ni_helper(x[0:i], x[i:], tracker): | |
result.append(tracker) | |
tracker = [] | |
return result |
from typing import List | |
class CombinationSum(object): | |
def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: | |
def dfs(comb, i, target, res): | |
if target == 0: | |
res.append(comb) | |
return | |
for j, x in enumerate(candidates[i:]): | |
if x <= target: |
class SudokuBacktracking(object): | |
def __init__(self, grid): | |
self.grid=grid | |
self.grid_size=9 | |
if not self.grid or len(self.grid)!=self.grid_size or len(self.grid[0])!=self.grid_size: | |
raise ('Must initialize the 9x9 board!') | |
def print_grid(self): | |
print('\n'.join(str(i) for i in self.grid)) |
class WordSearch(object): | |
def exist(self, board: [], word: str) -> bool: | |
for i in range(len(board)): | |
for j in range(len(board[i])): | |
if board[i][j] == word[0]: | |
if WordSearch.__search_adjacent(board, word[1:], i, j): | |
return True | |
return False |
import config | |
class Ring(object): | |
""" | |
Acts as an implementation interface | |
""" | |
def add(self, *keys): | |
raise NotImplementedError |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition: