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
public class Solution { | |
public List<List<Integer>> zigzagLevelOrder(TreeNode root) { | |
List<List<Integer>> res = new ArrayList<>(); | |
if(root == null) return res; | |
Queue<TreeNode> q = new LinkedList<>(); | |
q.add(root); | |
boolean order = true; | |
int size = 1; |
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
public class Solution { | |
// public List<List<Integer>> levelOrder(TreeNode root) { | |
// List<List<Integer>> result = new ArrayList<>(); | |
// Queue<TreeNode> queue = new LinkedList<>(); | |
// if(root == null) return result; | |
// queue.add(root); | |
// while(!queue.isEmpty()){ | |
// int size = queue.size(); | |
// List<Integer> tmpList = new ArrayList<>(); | |
// for(int i=0; i<size; i++){ |
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/bash | |
# This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo | |
# Attempts to cleanly stop and remove all containers, volumes and images. | |
docker ps -q | xargs --no-run-if-empty docker stop | |
docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes | |
docker volume ls -q | xargs --no-run-if-empty docker volume rm | |
docker images -a -q | xargs --no-run-if-empty docker rmi -f | |
# Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again. |
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/bash | |
wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz | |
tar xzf protobuf-2.6.1.tar.gz | |
cd protobuf-2.6.1 | |
sudo apt-get update | |
sudo apt-get install build-essential | |
sudo ./configure | |
sudo make | |
sudo make check | |
sudo make install |
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
var enums = {}; | |
enums.keyboard = { | |
BACKSPACE: 8, | |
TAB: 9, | |
ENTER: 13, | |
SHIFT: 16, | |
CTRL: 17, | |
ALT: 18, | |
PAUSE: 19, | |
CAPS_LOCK: 20, |