自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(169)
  • 收藏
  • 关注

转载 NumPy的详细教程

先决条件在阅读这个教程之前,你多少需要知道点python。如果你想从新回忆下,请看看Python Tutorial.如果你想要运行教程中的示例,你至少需要在你的电脑上安装了以下一些软件:PythonNumPy这些是可能对你有帮助的:ipython是一个净强化的交互Python Shell,对探索NumPy的特性非常方便。matplotlib将允许你绘图Sci

2015-04-16 05:01:49 535

转载 numpy和scipy介绍

转载于http://reverland.org/python/2012/08/24/scipy/#scipynumpymatplotlibSciPy入门指南(译) Published at 24 August 2012SciPy入门指南这个教程是为了帮助初学者掌握scipy并且肯能快地实际使用。什么是scipy、numpy

2015-04-16 03:03:32 3663

原创 [Leetcode] 142. Linked List II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. *

2015-04-13 23:43:27 536

原创 [Leetcode] 141. Linked List Cycle

Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. * class ListNode { * int val; *

2015-04-13 23:42:05 386

原创 [Leetcode] 140. Work Break II

Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, give

2015-04-12 03:36:45 509

原创 [Leetcode] 139. Work Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"

2015-04-12 03:10:49 687

原创 [Leetcode] 138. Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list./** * Definition for singly-l

2015-04-12 01:24:33 398

原创 [Leetcode] 137. Single Number II

Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without usi

2015-04-12 01:04:10 380

原创 [Leetcode] 136. Single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ext

2015-04-12 00:37:13 388

原创 [Leetcode] 135. Candy

There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements:Each child must have at least o

2015-04-11 22:56:23 428

原创 [Leetcode] 134. Gas Station

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to

2015-04-11 06:09:40 362

原创 [Leetcode] 133. Clone Graph

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each

2015-04-11 06:07:27 397

原创 字符串匹配, Zenefits的面试题

昨天面了Zenefits,觉得他家考题蛮有难度,不愧是现在湾区最火startup之一。当时也没写好,这里重写一下。String s1 = "waeginsapnaabangpisebbasepgnccccapisdnfngaabndlrjngeuiogbbegbuoecccc";String s2 = "a+b+c-";s2的形式是一个字母加上一个符号,正号代表有两个前面的字符,负

2015-04-11 00:07:47 743

原创 [Leetcode] 132. Palindrome Partitioning II

Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab",Return

2015-04-10 08:51:13 370

原创 [Leetcode] 131. Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","

2015-04-10 06:58:08 343

原创 [Leetcode] 130. Surrounded Region

Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O O X

2015-04-09 10:33:36 383

原创 [Leetcode] 129. Sum Roof to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota

2015-04-09 10:00:44 367

原创 [Leetcode] 128. Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3

2015-04-09 07:14:14 328

原创 [Leetcode] 127. Word Ladder

Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediate word m

2015-04-09 06:12:42 395

原创 [Leetcode] 126. Word Ladder II

Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can be changed at a timeEach intermediate word must exi

2015-04-09 06:09:07 468

原创 [Leetcode] 125. Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a

2015-04-07 02:51:11 339

原创 [Leetcode] 124. 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 3Return 6./

2015-04-07 02:42:18 327

原创 [Leetcode] 123. 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

2015-04-07 02:16:30 438

原创 [Leetcode] 122. 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 on

2015-04-07 02:12:45 335

原创 [Leetcode] 121. 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),

2015-04-07 02:07:12 369

原创 [Leetcode] 120. Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [

2015-04-07 02:04:51 301

原创 [Leetcode] 119. Pascal's Triangle II

Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?import java.ut

2015-04-07 01:54:15 344

原创 [Leetcode] 118. Pascal's Triangle

Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]import java.util.ArrayList;

2015-04-07 01:31:10 719

原创 [Leetcode] 117. Populating Next Right Pointers in Each Node II

Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant

2015-04-07 01:29:18 351

原创 [Leetcode] 116. Populating Next Right Pointers in Each Node

Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node.

2015-04-07 01:06:59 378

原创 [Leetcode] 115. Distinct Subsequences

Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be non

2015-04-05 04:00:52 382

原创 [Leetcode] 114. Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1

2015-04-05 02:14:53 381

原创 [Leetcode] 113. Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \

2015-04-05 01:38:47 350

原创 [Leetcode] 112. Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum

2015-04-05 01:35:22 328

原创 [Leetcode] 111. Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node./** * Definition for binary tree

2015-04-05 01:22:45 326

原创 [Leetcode] 110. 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 diffe

2015-04-05 00:55:08 308

原创 [Leetcode] 109. Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for singly-linked list. * public class ListNode { * int val; *

2015-04-05 00:14:14 337

原创 [Leetcode] 108. Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; *

2015-04-05 00:08:55 297

原创 [Leetcode] 107. 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},

2015-04-04 23:54:12 356

原创 [Leetcode] 106. Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree./** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right;

2015-04-04 23:39:55 322

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除