程序员的世界, 为程序员服务

2016-07-09
python系统性能信息模块-psutil

psutil模块能够轻松获取系统能够运行的进程和系统利用率(包括CPU、内存、磁盘、网络等)信息。主要用于系统监控,分析和限制系统资源及进程的管理。 它实现了很多同等命令行工具提供的功能,如ps、top、df等。

Read More

2016-07-09
System Design Preparation

https://www.hackerrank.com/domains https://oj.leetcode.com/problemset/algorithms/ LeetCode至少要刷三遍,付费部分的题建议花点钱看一下,舍不得孩子套不着狼 http://lintcode.com/ http://new.ninechapter.com/solutions/ http://www.geeksforgeeks.org/about/interview-corner/ TopCoder Algorithm Tutorial: http://help.topcoder.com/data-science

Read More

2016-06-30
Resevior Sampling蓄水池算法java实现

Resevior Sampling Randomly return the index of maximal elements in the array.follow up: 要求linear time 和constant space 先把前k个数放入蓄水池,对第k+1,我们以k/(k+1)概率决定是否要把它换入蓄水池,换入时随机的选取一个作为替换项,这样一直做下去,对于任意的样本空间n,对每个数的选取概率都为k/n。也就是说对每个数选取概率相等。 Create an array reservoir[0..k-1] and copy first k items of stream[] to

Read More

2016-06-29
Top 25 Angular.js Interview Questions

1) What is Angular.js? AngularJS is a javascript framework used for creating single web page applications. It allows you to use HTML as your template language and enables you to extend HTML’s syntax to express your application’s components clearly 2) Explain what are the key features of Angular.

Read More

2016-06-29
NodeJS 学习资料

InstallationGo to http://nodejs.org/, download node.js installer and follow instructions. Mac OS, Windows, and Linux are supported. JavaScriptTo use Node.js you need to have a decent understanding of JavaScript language. Codecademy - JS - Good for practicing and learning syntax. Crockford’s video

Read More

2016-06-29
LeetCode-Rotate List

##题目 ####Rotate List Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.

Read More

2016-06-29
LeetCode-Best Time to Buy and Sell Stock II

##题目 ####Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times). However

Read More

2016-06-29
LeetCode-Best Time to Buy and Sell Stock IV

##题目 ####Best Time to Buy and Sell Stock IV Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most k transactions. ####Note:You may not engage in multiple transactions at the same time (ie, you

Read More

2016-06-29
LeetCode-Anagrams

##题目 ####Anagrams Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case.

Read More

2016-06-29
LeetCode-Balanced Binary Tree

##题目 ####Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.

Read More

2016-06-29
LeetCode-Best Time to Buy and Sell Stock III

##题目 ####Best Time to Buy and Sell Stock III Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. ####Note:You may not engage in multiple transactions at the same time (ie,

Read More

2016-06-29
LeetCode-Best Time to Buy and Sell Stock

##题目 ####Best Time to Buy and Sell Stock 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 (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.

Read More

2016-06-29
LeetCode-Binary Search Tree Iterator

##题目 ####Binary Search Tree Iterator Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the next smallest number in the BST. Note: next() and hasNext() should run in average O(1) time and uses O(h) memory,

Read More

2016-06-29
LeetCode-Binary Tree Inorder Traversal

##题目 ####Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes’ values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, could you do it iteratively? confused what "{1,#,2,3}" means? > rea

Read More

2016-06-29
LeetCode-Binary Tree Level Order Traversal II

##题目 ####Binary Tree Level Order Traversal II Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root). For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7 return its bottom-up level o

Read More

2016-06-29
LeetCode-Binary Tree Maximum Path Sum

##题目 ####Binary Tree Maximum Path Sum Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example:Given the below binary tree, 1 / \ 2 3 Return 6.

Read More

2016-06-29
LeetCode-Binary Tree Postorder Traversal

##题目 ####Binary Tree Postorder Traversal Given a binary tree, return the postorder traversal of its nodes’ values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [3,2,1]. Note: Recursive solution is trivial, could you do it iteratively?

Read More

2016-06-29
LeetCode-Binary Tree Level Order Traversal

##题目 ####Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level). For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7 return its level order traversal as: [ [3], [9,20], [

Read More

2016-06-29
LeetCode-Binary Tree Zigzag Level Order Traversal

##题目 ####Binary Tree Zigzag Level Order Traversal Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between). For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7

Read More

2016-06-29
LeetCode-Binary Tree Preorder Traversal

##题目 ####Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes’ values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]. Note: Recursive solution is trivial, could you do it iteratively?

Read More