Skip to content

Instantly share code, notes, and snippets.

View bobfang1992's full-sized avatar
🏠
Working from home

Bob Fang bobfang1992

🏠
Working from home
View GitHub Profile
Date Cost Charges
12/29 $0.00 0
12/30 $0.00 0
12/31 $0.00 0
01/01 $0.00 0
01/02 $0.00 0
01/03 $0.00 0
01/04 $0.00 0
01/05 $0.00 0
Date Cost Charges Avg per charge
01/21 $100.00 1 $100.00
01/23 $60.98 6 $10.16
01/24 $391.79 37 $10.59
01/25 $41.16 4 $10.29
01/26 $184.06 17 $10.83
01/27 $107.64 10 $10.76
Total $885.63 75 $11.81
@bobfang1992
bobfang1992 / threadapi.json
Created March 6, 2021 22:51
threadapi.json
// 20210306225038
// https://duibiao-1298595392.ap-east-1.elb.amazonaws.com/api/threads/?category=6
{
"results": [
{
"id": 66,
"category": 6,
"title": "How to create a time_point object with year month day?",
"replies": 0,
@bobfang1992
bobfang1992 / word_break.java
Last active January 10, 2021 00:42
mock_interview_3
/*
s = "applepenapple" dictionary = ["apple", "pen"]
s = "apple" + "pen" + "apple"
return True
s = "appplepearapple" dictionary = ["apple", "pen"]
return False
@bobfang1992
bobfang1992 / mock_interview_2.txt
Last active January 5, 2021 14:29
mock_interview_2
//
//Given two sequences pushed and popped with distinct values,
//return true if and only if this could have been the result of a sequence of push and pop operations on an initially empty stack.
//Example 1:
//Input: pushed = [1,2,3,4,5], popped = [4,5,3,2,1]
//Output: true
//Explanation: We might do the following sequence:
@bobfang1992
bobfang1992 / 1265.py
Created January 2, 2021 22:16
Mock Interveiw 1--1265. Print Immutable Linked List in Reverse
// Print Immutable Linked List in Reverse
// immutable linked list, print out all values of each node in reverse
// APIs:
// ImmutableListNode: An interface of immutable linked list, you are given the head of the list.
// You need to use the following functions to access the linked list (you can't access the ImmutableListNode directly):
// ImmutableListNode.printValue(): Print value of the current node.
// ImmutableListNode.getNext(): Return the next node.
# getNext() -> ImmutableListNode or None
@bobfang1992
bobfang1992 / 1379.py
Created January 2, 2021 11:10
Leetcode 1379
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def getTargetCopy(self, original: TreeNode, cloned: TreeNode, target: TreeNode) -> TreeNode:
val = target.val
@bobfang1992
bobfang1992 / 84.py
Created December 31, 2020 16:44
Leetcode 84
class Solution:
def largestRectangleArea(self, heights: List[int]) -> int:
stack = [-1]
result = 0
heights.append(0)
for i in range(len(heights)):
while stack and heights[stack[-1]] > heights[i]:
h = heights[stack.pop()]
w = i - stack[-1] - 1
@bobfang1992
bobfang1992 / 289.py
Created December 30, 2020 17:07
Leetcode 289
class Solution:
def gameOfLife(self, board: List[List[int]]) -> None:
"""
Do not return anything, modify board in-place instead.
"""
m = len(board)
if m == 0:
return
n = len(board[0])
from fastapi import FastAPI
import uuid
app = FastAPI()
COM_API_OBJECT = {}
@app.get("/create")
async def create():