Skip to content

Instantly share code, notes, and snippets.

Tschüss STL

Joshua Haupt HauptJ

Tschüss STL
Block or report user

Report or block HauptJ

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import sys
import os
import pandas as pd
NARRATIVE = "Consumer complaint narrative"
inFile = str(sys.argv[1])
label = str(sys.argv[2])
outFile = label.replace(" ", "_")
HauptJ /
Created Mar 28, 2020
OVH API Re-Imaging Script
#!/usr/bin/env python3
import ovh
import json
import argparse
def reimage(ovhClient, ovhServerName, sshKeyName, hostName, ovhTemplateName, useDistribKernel=False):
HauptJ /
Created Mar 14, 2020
Maximum Subarray Sum
class Solution:
# Dynamic Programming: Time: O(n) Space O(n)
def maxSubArrayDP(self, nums: List[int]) -> int:
if not nums:
return 0
maxSum = nums[0]
DP = [0]*len(nums) # DP will hold the max sum so far
HauptJ /
Created Mar 14, 2020
LinkedList Palindrome - Stack
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# = None
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
# low hanging fruit
def flatten_dictionary(dictionary):
flattened = {}
flattened = flatten_helper("", dictionary, flattened)
return flattened
def flatten_helper(initKey, dictionary, flattened):
for k, v in dictionary:
if not isInstance(v, dict):
if initKey is None or initKey == "":
from collections import deque
class Solution:
def wallsAndGates(self, rooms: List[List[int]]) -> None:
Do not return anything, modify rooms in-place instead.
if not rooms:
return 1
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
list = []
tempList = []
def backtrack(list, tempList, nums):
if len(tempList) == len(nums):
View candies
import math
import os
import random
import re
import sys
# Complete the candies function below.
def candies(n, arr):
class Solution {
static int WHITE = 0, GRAY = 1, BLACK = 2;
private int V;
private LinkedList<Integer> adj[];
Graph(int v) {
V = v;
from collections import defaultdict
class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
gra = Graph(len(prerequisites))
for preReq in prerequisites:
gra.addEdge(preReq[0], preReq[1])
You can’t perform that action at this time.