Ping World

Map the world!

LeetCode: Best Time to Buy and Sell Stock

"Algorithms"

Description Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (i.e., buy one and sell one share...

LeetCode: Maximum Subarray

"Algorithms"

Description Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5,4], Outpu...

Run shadowsocks with Docker

""

Ubuntu 16.01 Minimal environment Install the latest docker version Steps here Pull shadowsocks image and run 1 2 3 4 5 6 7 docker pull oddrationale/docker-shadowsocks # wit...

Lodes_map

LODES home work remain Population 70,070 13,065 6,277 2,663 1,246 632 308 124

Book 《Clean Code》 Notes

""

Chapter 3: Functions Functions should DO ONE THING. They should do it WELL. They should do it ONLY.

Codility

"Algorithms"

1 %config IPCompleter.greedy=True Merge sort Sort an array. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 def split_sort(A): if len(A) <= 1: return A...

Places i have been

Places I Have Been

Python Tricks

"Good to know"

Sort a Python dictionary by value Making use of the sorted() function, pass in a callable function/object to the key parameter to make comparison. Using Lambda specify the value (index 1) 1 2 d = ...

PostgreSQL and PostGIS

""

PostGIS is an extensional enabling the spatial object and analysis support for PostgreSQL databse. Question Produce a list of facilities with a total revenue less than 1000. Produce an outpu...

AWS: Self Learning

"Essential Training"

Most resources in this post are from Lynda.com AWS Essential Training. Design for Failures Virtual servers EC2 Elastic IP: no instance specific/Acount level/Easily remapped from instan...