- 博客(146)
- 资源 (116)
- 收藏
- 关注
原创 【LeetCode with Python】 ZigZag Conversion
博客域名:http://www.xnerv.wang 原题页面:https://leetcode.com/problems/zigzag-conversion/ 题目类型:下标计算 难度评价:★ 本文地址:http://blog.youkuaiyun.com/nerv3x3/article/details/40660835
2015-10-05 23:15:44
17845
原创 【LeetCode with Python】 ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I I GY I RAnd then read line by line: "PAHNAPLSIIGYIR
2015-02-11 14:08:41
12185
原创 【LeetCode with Python】 Valid Number
Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing
2014-11-30 21:52:37
12032
原创 【LeetCode with Python】 Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]]
2014-11-30 21:50:32
12911
原创 【LeetCode with Python】 Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]You should return [1,2,3,6,9,8,7,4,5].
2014-11-30 21:49:27
12465
原创 【LeetCode with Python】 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 using extra memory?
2014-09-21 17:52:05
122357
原创 【LeetCode with Python】 Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue re
2014-09-21 17:51:15
14042
原创 【LeetCode with Python】 Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Here are few examples.[1,3,5,6], 5 → 2[1,3,5,6], 2 → 1
2014-09-21 17:50:11
111866
原创 【LeetCode with Python】 Simplify Path
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.Corner Cases: Did you consider the case where path = "/../"? In this case, you sh
2014-09-21 17:49:20
12690
原创 -
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now [1,1,2,2,3].
2014-09-21 17:47:40
16204
原创 【LeetCode with Python】 Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array return its index, otherwise return -1.You may assume no duplicate
2014-09-21 17:47:15
10571
原创 【LeetCode with Python】 Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of the two partitions.For example,Given 1->4->3->2->5->2
2014-09-21 17:46:32
10317
原创 【LeetCode with Python】 N-Queens II
Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.
2014-09-21 17:45:37
10381
原创 【LeetCode with Python】 N-Queens
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.Each solution contains a distinct board configuration of the
2014-09-21 17:44:49
10738
原创 【LeetCode with Python】 Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:Given intervals [1,3],[6,9], insert and merge [2,5
2014-09-21 17:41:53
21465
原创 【LeetCode with Python】 Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
2014-09-21 17:41:21
10742
原创 【LeetCode with Python】 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 \ 2 \ 3 \ 4 \
2014-09-21 17:38:47
10831
原创 【LeetCode with Python】 Count and Say
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as "one 2, then one 1" or 1211.Given an integer n, generate the nt
2014-09-21 17:38:23
10372
原创 【LeetCode with Python】 Divide Two Integers
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.
2014-09-21 17:37:42
10035
原创 【LeetCode with Python】 Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
2014-09-21 17:35:58
3028
原创 【LeetCode with Python】 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.
2014-09-21 17:35:33
2950
原创 【LeetCode with Python】 Combination Sum II
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combination.Note: All numbers (including target) will be pos
2014-09-21 17:33:54
3145
原创 【LeetCode with Python】 Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]
2014-09-21 17:33:01
2859
原创 【LeetCode with Python】 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 one candy. Children with a higher rating get more cand
2014-09-21 17:31:34
2963
原创 【LeetCode with Python】 Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited number of times.Note: All numbers (including target) will
2014-09-21 17:30:59
16482
原创 【LeetCode with Python】 Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now [1,1,2,2,3].
2014-08-29 18:37:22
3024
原创 【LeetCode with Python】 Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given 1->1->1->2->3, return 2->3.
2014-08-29 18:36:24
3329
原创 -
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?
2014-08-29 18:35:11
13255
原创 【LeetCode with Python】 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.
2014-08-29 18:34:04
3130
原创 【LeetCode with Python】 Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the di
2014-08-29 18:11:24
3364
原创 【LeetCode with Python】 Sort List
Sort a linked list in O(n log n) time using constant space complexity.
2014-07-26 14:17:25
15616
原创 【LeetCode with Python】 Permutations II
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], and [2,1,1].
2014-07-20 16:27:04
16201
原创 【LeetCode with Python】 Rotate Image
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?
2014-07-19 21:04:39
4015
原创 【LeetCode with Python】 Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ / / / \ \ 3 2 1 1 3
2014-07-06 15:41:58
24697
原创 【LeetCode with Python】 Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your
2014-07-06 15:39:19
26983
原创 【LeetCode with Python】 Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example,Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.The above elevation map is represented by arra
2014-07-06 15:38:01
6931
原创 【LeetCode with Python】 Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the following is not: 1 / \ 2 2 \ \ 3 3Note:
2014-07-06 15:34:35
5830
原创 【LeetCode with Python】 Sum Root 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 total sum of all root-to-leaf numbers.For example, 1 / \
2014-07-06 15:32:35
3036
原创 【LeetCode with Python】 Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution using O(mn) space is probably a bad idea.A simple improvement uses O(m
2014-07-06 15:30:50
6262
让你不再害怕指针
2015-01-25
转换指南:将程序从托管扩展C++迁移到C++/CLI
2015-01-25
数据结构C++语言描述 - William Ford - 清华大学出版社
2015-01-25
深度探索C++对象模型 - Stanley B.Lippman - 华中科技大学出版社
2015-01-25
编程精粹:Microsoft编写优质无错C程序秘诀 - Steve Maguire - 电子工业出版社
2015-01-25
C和C++代码精粹 - Bruce_Eckel - 人民邮电出版社
2015-01-25
C++语言的设计和演化 - Bjarne Stroustrup - 机械工业出版社
2015-01-24
C++面向对象多线程编程 - Cameron Hughes - 人民邮电出版社
2015-01-24
C++高级参考手册 - Clayton Walnum - 电子工业出版社
2015-01-24
C++编程思想 - Bruce Eckel - 机械工业出版社
2015-01-24
C++ Templates 简体中文版 David Vandevoorde 人民邮电出版社
2015-01-24
C++编程规范:101条准则、规则与最佳实践.Herb Sutter.人民邮电出版社
2015-01-24
软件工程:实践者的研究方法 第六版中文版 Roger S Pressman 机械工业出版社
2015-01-23
嵌入式计算系统设计原理 - Wayne Wolf - 机械工业出版社
2015-01-23
精通Qt4编程 - 蔡志明 - 电子工业出版社
2015-01-23
汇编语言 第2版 王爽 清华大学出版社
2015-01-23
编译原理 第二版中文版 Alfred V Aho 机械工业出版社
2015-01-23
The Science Of Programming - David Gries
2015-01-23
ZendStudio 12 0 1 linux gtk x86 64 part2 含破解工具 共两个压缩卷
2015-01-23
ZendStudio 12 0 1 linux gtk x86 64 part1 含破解工具 共两个压缩卷
2015-01-23
计算机程序的构造和解释(中文第二版) - Harold Abelson - 机械工专业出版社
2015-03-22
PHP高级程序设计:模式、框架与测试 - Kevin McArthur - 人民邮电出版社
2015-02-20
算法导论(第三版) 中文完整清晰版PDF 带书签
2015-02-01
深入理解MySQL核心技术 中文版 Sasba Pachev 中国电力出版社
2015-01-25
SQL编程风格 - Joe Celko - 人民邮电出版社
2015-01-25
MySQL网络数据库指南 - Paul DuBois - 机械工业出版社
2015-01-25
MySQL核心内幕 - 祝定泽 - 清华大学出版社
2015-01-25
MySQL核心技术手册 第二版中文版 Russell J T Dyer 机械工业出版社
2015-01-25
鸟哥的Linux私房菜服务器架设篇(第三版) - 鸟哥 - 机械工业出版社
2015-01-25
Linux内核设计与实现(第三版中文版) - Robert Love - 机械工业出版社
2015-01-25
Bash Beginners Guide(中文版) - Machtelt Garrels
2015-01-25
TCP/IP详解(卷1,卷2,卷3) - W.Richard Stevens - 机械工业出版社
2015-01-25
推荐系统实践(高清版).项亮.人民邮电出版社
2015-01-23
设计模式:基于C#的工程化实现及扩展.王翔.电子工业出版社
2015-01-23
图像处理 分析与机器视觉 第三版中文版 Milan Sonka 人民邮电出版社
2015-01-23
推荐系统实践(高清版) - 项亮 - 人民邮电出版社
2015-01-23
设计模式:基于C#的工程化实现及扩展 - 王翔 - 电子工业出版社
2015-01-23
软件工程:实践者的研究方法 第七版中文版 Roger S Pressman 机械工业出版社
2015-01-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人