Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<style media="screen">
html {
height: 100%;
width: 100%;
}
body {
function mergeSort(arr) {
if (arr.length < 2) return arr;
var mid = (arr.length - 1) >> 1;
var l = mergeSort(arr.slice(0, mid + 1));
var r = mergeSort(arr.slice(mid + 1));
return merge(l, r);
}
global
maxconn 100
defaults
log global
option httplog
timeout connect 5000
timeout client 50000
timeout server 50000
/*
HOW TO RUN THIS SCRIPT
node ws.js input.txt
*/
console.log(findPaths());
/*
main routine
*/
/**
* @param {number[]} heights
* @return {number}
*/
function largestRectangleArea(heights) {
heights.push(-1);
var stack = [];
var max = 0;
heights.forEach((h, i) => {
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def reverseList(self, head):
prev = None

variable

prime_counter = 1
@linfongi
linfongi / Note.md
Created October 9, 2016 22:34
Note

Notes

  • HTML5 history API
@linfongi
linfongi / 400.java
Last active February 16, 2017 06:46
public class Solution {
public int findNthDigit(int n) {
int digitCount = 1;
long threshold = 9 * (long)Math.pow(10, digitCount - 1) * digitCount;
while (n > threshold) {
n -= threshold;
threshold /= digitCount;
threshold *= 10 * (++digitCount);
}