Skip to content

Instantly share code, notes, and snippets.

:octocat:
Tschüss STL

Joshua Haupt HauptJ

:octocat:
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
View label.py
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
HauptJ / image.py
Created Mar 28, 2020
OVH API Re-Imaging Script
View image.py
#!/usr/bin/env python3
import ovh
import json
import argparse
def reimage(ovhClient, ovhServerName, sshKeyName, hostName, ovhTemplateName, useDistribKernel=False):
@HauptJ
HauptJ / maxSubarraySum.py
Created Mar 14, 2020
Maximum Subarray Sum
View maxSubarraySum.py
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
HauptJ / LinkedListPalindromeStack.py
Created Mar 14, 2020
LinkedList Palindrome - Stack
View LinkedListPalindromeStack.py
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
# low hanging fruit
View FlattenDictionary.py
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 == "":
View WallsAndGates.py
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
View permutations.py
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
list = []
tempList = []
def backtrack(list, tempList, nums):
if len(tempList) == len(nums):
list.append(tempList)
else:
View candies
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the candies function below.
def candies(n, arr):
View courseSchedule2.java
class Solution {
static int WHITE = 0, GRAY = 1, BLACK = 2;
private int V;
private LinkedList<Integer> adj[];
Graph(int v) {
V = v;
View courseSchedule.py
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.