自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

jxfang的专栏

温柔互助,共行一程

  • 博客(195)
  • 资源 (4)
  • 收藏
  • 关注

原创 leetcodeOJ 83. Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. /** * Definition for s

2017-04-13 21:33:19 196

原创 leetcodeOJ 71. 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 yo

2017-04-13 18:31:11 229

原创 leetcodeOJ 63. Unique Paths II

Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space is marked as 1 and 0 respectively in the grid

2017-04-13 17:05:17 202

原创 leetcodeOJ 442. Find All Duplicates in an Array

Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twice in this array. Could you do it without extr

2017-04-13 16:47:59 221

原创 leetcodeOJ 520. Detect Capital

Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: All letters in thi

2017-04-13 16:43:05 250

原创 leetcodeOJ 52. N-Queens II

Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. 方法类似leetcodeOJ51题 class Solution { public: int totalNQueens(int n)

2017-04-13 10:40:24 236

原创 leetcodeOJ 51. 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. E

2017-04-13 10:34:21 252

原创 leetcodeOJ 216. Combination Sum III

Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. Example 1: Input:

2017-04-13 09:46:12 213

原创 leetcodeOJ 77. 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], ]

2017-04-13 09:22:03 219

原创 leetcodeOJ 189. Rotate Array

Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note: Try to come up as many solutions as yo

2017-04-12 17:08:01 233

原创 leetcodeOJ 61. 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. /** * Definition for singly-link

2017-04-12 15:59:12 196

原创 leetcodeOJ 55. Jump Game

Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine i

2017-04-12 15:25:48 217

原创 leetcodeOJ 162. Find Peak Element

A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its index. The array may contain multiple peaks, in

2017-04-12 15:24:46 191

原创 leetcodeOJ 139. Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. You may as

2017-04-10 12:03:56 188

原创 leetcodeOJ 72. Edit Distance

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have the following 3 operations permitted on a word:

2017-04-10 11:07:19 231

原创 leetcodeOJ 90. Subsets II

Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,2], a sol

2017-04-09 23:06:01 191

原创 leetcodeOJ 78. Subsets

Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,3], a solution is: [ [3], [1],

2017-04-09 22:44:21 208

原创 leetcodeOJ 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], [

2017-04-09 21:59:32 174

原创 leetcodeOJ 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? 思路跟leetcodeO

2017-04-09 21:21:18 163

原创 leetcodeOJ 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] ] 代码如下: //打印杨辉三角 class Soluti

2017-04-09 21:17:40 263

原创 leetcodeOJ 22. Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: [ "((()))", "(()())", "(())()", "()(())",

2017-04-09 17:30:41 268

原创 leetcodeOJ 228. Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 题意:把数组中连续数字a,a+1, a+2, ..., b表示成"a->b" 代码如下: class

2017-04-09 16:26:57 218

原创 leetcodeOJ 62. 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 bo

2017-04-09 15:56:42 156

原创 leetcodeOJ 64. Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at

2017-04-09 15:29:26 179

原创 leetcodeOJ 16. 3Sum Closest

Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact

2017-04-09 11:00:26 185

原创 leetcodeOJ 43. Multiply Strings

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2. Note: The length of both num1 and num2 is Both num1 and num2 contains only digits 0

2017-04-09 10:13:14 245

原创 leetcodeOJ 537. Complex Number Multiplication

Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the definition. Example 1: Input: "1+1i", "1+1i" Outpu

2017-04-09 09:38:04 199

原创 leetcodeOJ 66. Plus One

Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leading zero, except the number 0 itself. The digits a

2017-04-07 15:59:25 377

原创 leetcodeOJ 67. Add Binary

Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 位操作,从右向左加,注意进位,得到的字符串最后需要逆转 class Solution { public: string addBinary(string a,

2017-04-07 15:27:34 272

原创 leetcodeOJ 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), d

2017-04-07 15:06:16 146

原创 leetcodeOJ 53. Maximum Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has

2017-04-07 14:40:15 212

原创 leetcodeOJ 91. Decode Ways

参考了大牛的博客:http://blog.csdn.net/linhuanmars/article/details/24570759 A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26

2017-04-07 12:12:05 261

原创 leetcodeOJ 70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive

2017-04-07 11:01:49 186

原创 leetcodeOJ 23. Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 思路:可以两两进行归并排序, 代码如下: /** * Definition for singly-linked list. * struct ListNode { * int

2017-04-07 10:06:33 219

原创 leetcodeOJ 148. Sort List

Sort a linked list in O(n log n) time using constant space complexity.  在O(nlogn)时间内,给一单向链表排序 分析,时间复杂度有要求,考虑用mergesort 取单向链表的中间元素: ListNode* temp = head;//temp每次移动一步 ListNode* pre = he

2017-04-07 09:44:46 194

原创 leetcodeOJ 342. Power of Four

Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num = 5, return false. Follow up: Could you solve it without loo

2017-04-06 13:12:58 187

原创 leetcodeOJ 326. Power of Three

Given an integer, write a function to determine if it is a power of three. 代码如下: class Solution { public: bool isPowerOfThree(int n) { int maxThreePowerInt = 1162261467; if(n ma

2017-04-06 13:00:44 212

原创 leetcodeOJ 191. Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit integer ’11' has binary representation 00000000

2017-04-06 12:18:08 208

原创 leetcodeOJ 231. Power of Two

Given an integer, write a function to determine if it is a power of two. //思路:power of two 表示n的bit位上只有一位为1 class Solution { public: bool isPowerOfTwo(int n) { if(n <= 0) retur

2017-04-06 12:01:06 224

原创 leetcodeOJ 372. Super Pow

Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array. Example1: a = 2 b = [3] Result: 8 Example2: a

2017-04-06 10:59:34 212

pil-handbook.pdf

Python PIL的工具书,PDF英文版

2016-11-08

冰点文库下载器

冰点文库下载器,可以免费下载百度文库的文章,很方便

2015-06-20

C语言经典算法100例

很好的练习C语言的材料,比较简单,基础性的资料,希望对大家有帮组

2015-06-15

设计模式之禅

如果说“四人帮”的《设计模式》是设计模式领域的“圣经”,那么之后出版的各种关于设计模式的书都可称之为“圣经”的“注释版”或“圣经的故事”。《设计模式之禅》是得道者对“圣经”的“禅悟”,它既不像“圣经”那样因为惜字如金、字字珠玑而深奥、晦涩和难懂,又比“圣经”的“注释版”更深刻和全面、更通俗和生动、更接近开发者遇到的实践场景,更具指导性。

2015-04-23

空空如也

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

TA关注的人

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