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 sys | |
# Problem: https://code.google.com/codejam/contest/2974486/dashboard#s=p0 | |
# Reference: http://codereview.stackexchange.com/a/154360/73051 | |
def main(): | |
submit = False | |
filename = "A-small-practice" |
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
package main | |
import ( | |
"io/ioutil" | |
"os" | |
"strconv" | |
"strings" | |
"text/scanner" | |
) |
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
package bar.foo; | |
public class LinkedList { | |
Node head; | |
// Push i to the first index of the linked list, so i becomes the new head. | |
void push(int i) { | |
Node n = new Node(i); | |
n.next = this.head; | |
this.head = n; |
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
package org.sooo; | |
public class Ch1 { | |
public static char[] removeDup(char[] str) { | |
if (str == null || str.length == 1) { | |
return str; | |
} | |
// mark duplicated characters to special character (a.k.a. dupChar). | |
char dupChar = '\0'; |
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
package com.foo; | |
import java.util.Stack; | |
/* | |
Find sum of n elements after kth smallest element in BST. | |
Tree is very large, you are not allowed to traverse the tree. | |
*/ | |
public class BST { |
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
// Place your settings in this file to overwrite the default settings | |
{ | |
"files.autoSave": "onWindowChange", | |
"files.associations": { | |
"*.tac": "python", | |
"*.ace": "jade" | |
}, | |
"search.exclude": { | |
"**/node_modules": true, | |
"**/bower_components": true, |
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
package main | |
import ( | |
"fmt" | |
"time" | |
"encoding/json" | |
elastic "gopkg.in/olivere/elastic.v3" | |
) |
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
#!/bin/sh | |
# Reference: http://blog.yohanliyanage.com/2015/05/docker-clean-up-after-yourself/ | |
docker rm -v $(docker ps -a -q -f status=exited) | |
docker rmi $(docker images -f "dangling=true" -q) | |
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
/* | |
This code is based on sample codes from 'Go Concurrency Patterns', Rob Pike's Google I/O 2012 presentation. |
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
(defn my-reverse-v1 [input] | |
(let [head (first input) | |
tail (rest input)] | |
(if head | |
(conj (my-reverse-v1 (vec tail)) | |
(if (sequential? head) | |
(my-reverse-v1 (vec head)) | |
head)) | |
[]))) |