{{ message }}

Instantly share code, notes, and snippets.

😀

# Chao Xu chaoxu

😀
Last active Jan 26, 2022
View block_submodular.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 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
Last active Mar 18, 2021
Subset sum
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

Last active Jul 21, 2020
Yotta quantiles
View yotta.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 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
Last active Jun 5, 2020
Last active Apr 8, 2020

View VCG.md

• 各种类似的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%.
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
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 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}}',
Last active Mar 27, 2019
View Airplane.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 import java.util.*; class PLC{ public TreeMap segmentlist = new TreeMap(); public int upperBound = 0; public int lastSlope = 0; public int startValue = 0; public int shift = 0; private static int INF = 100000000; private int lb() {
Created Mar 3, 2019
Selected problems
View gist:591bb746d0b67703da611407546a6bb0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 \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/}
Created Mar 3, 2019
Selected problems
View gist:faf9dcd3aedc435b09467bb14f7b94f1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 \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/}