Skip to content

Instantly share code, notes, and snippets.

Avatar
😀

Chao Xu chaoxu

😀
View GitHub Profile
View block_submodular.py
from gurobipy import *
from itertools import *
from functools import partial, reduce
import random
import sys
import math
from operator import mul
### Set and partition operations
View description.md

This is demo code for the journal version of the faster subset sum paper.

Konstantinos Koiliaris and Chao Xu. 2019. Faster Pseudopolynomial Time Algorithms for Subset Sum. ACM Trans. Algorithms 15, 3, Article 40 (July 2019), 20 pages. DOI:https://doi.org/10.1145/3329863

@chaoxu
chaoxu / yotta.py
Last active Jul 21, 2020
Yotta quantiles
View yotta.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
import math
N = 400 # number of tickets
i = 100000 # number of trials
k = 52 # number of weeks
rate = 0.002 # standard apr
@chaoxu
chaoxu / VCG.md
Last active Apr 8, 2020
关于Visa GC
View VCG.md

这么多GC里面最强力的GC应该是Visa GC了(同理还有Mastercard和amex的, 但是比较少见, 用起来差不多). Visa GC (VGC)会有不同的银行发行.

让p%为你的最强任意地方返现卡. 相信大多人这张卡是下面3个

  • 各种类似的2%返现卡.
  • Chase freedom unlimited, 1.5 UR, 价值2.25%.
  • Citi double cash, 可以转换成 2 TYP, 价值2.5%.
  • Amex blue business plus 2 MR 价值2.5% (上限是一年50k spend, 普通人应该用不完).
  • BoA premium + platinum honors 是2.625%.
@chaoxu
chaoxu / leetcode.md
Last active May 7, 2022
Interesting leetcode problems
View leetcode.md

This is an index of leetcode problems that I find interesting.

You can see many theoretical solutions by hqztrue here.

TCS Problems

Likely only people who work in the area knows the current best solution. The best solution is either in some paper, or requires advanced tricks.

  • 001 2SUM
  • 004 Median of Two Sorted Arrays
@chaoxu
chaoxu / mathconf.js
Last active May 2, 2021
Typora mathjax config. Need to change the file in `/Applications/Typora.app/Contents/Resources/TypeMark/index.html`
View mathconf.js
MathJax.Hub.Config({
skipStartupTypeset: true,
jax: ["input/TeX", "output/SVG"],
extensions: ["tex2jax.js", "toMathML.js"],
TeX: {
extensions: ["noUndefined.js", "autoload-all.js", "AMSmath.js", "AMSsymbols.js", "mediawiki-texvc.js"],
mhchem: { legacy: false },
Macros: {
R: '{\\mathbb{R}}',
View Airplane.java
import java.util.*;
class PLC{
public TreeMap<Integer, Integer> segmentlist = new TreeMap<Integer, Integer>();
public int upperBound = 0;
public int lastSlope = 0;
public int startValue = 0;
public int shift = 0;
private static int INF = 100000000;
private int lb() {
View gist:591bb746d0b67703da611407546a6bb0
\begin{itemize}
\item Tree reconstruction from inorder and postorder.
\item find path sum in the tree \url{https://leetcode.com/problems/path-sum-ii/}
\item longest substring without repeated character. \url{https://leetcode.com/problems/longest-substring-without-repeating-characters/}
\item Longest Palindromic Substring \url{https://leetcode.com/problems/longest-palindromic-substring/}
\item Container With Most Water \url{https://leetcode.com/problems/container-with-most-water/solution/}
\item 3sum, 4sum, ksum
\item next permutation \url{https://leetcode.com/problems/next-permutation/}
\item Permutation generation \url{https://leetcode.com/problems/permutations-ii/}
\item Group Anagrams \url{https://leetcode.com/problems/group-anagrams/}
View gist:faf9dcd3aedc435b09467bb14f7b94f1
\begin{itemize}
\item Tree reconstruction from inorder and postorder.
\item find path sum in the tree \url{https://leetcode.com/problems/path-sum-ii/}
\item longest substring without repeated character. \url{https://leetcode.com/problems/longest-substring-without-repeating-characters/}
\item Longest Palindromic Substring \url{https://leetcode.com/problems/longest-palindromic-substring/}
\item Container With Most Water \url{https://leetcode.com/problems/container-with-most-water/solution/}
\item 3sum, 4sum, ksum
\item next permutation \url{https://leetcode.com/problems/next-permutation/}
\item Permutation generation \url{https://leetcode.com/problems/permutations-ii/}
\item Group Anagrams \url{https://leetcode.com/problems/group-anagrams/}