自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

popfish的算法路

Java, Algorithm, Coding

  • 博客(13)
  • 收藏
  • 关注

原创 Leetcode上几道Binary Search题需要注意的地方

Binary Search的原理很容易理解,但是每次脚标没算对弄得溢出或是死循环的时候总是很恼火。今天就把Leetcode上几道经典的利用Binary Search解的题放在一起来感受一下。一般有几个比较容易迷糊的地方,·1. 终止条件不同 是取 start  2. 分半的时候是取mid, mid - 1, 还是mid + 1 (这里mid含义对应数组的index, 如果涉及到

2013-06-30 17:10:38 3601

原创 Leetcode上和DFS有关题目整理 (内含目录)

总结一下Leetcode上一些比较经典的利用dfs思路解的题:按照顺序排了一下,如果从第一道题一直做到最后一道题,会对dfs有一个新的认识。我们从最典型的开始,首先是关于数字集合的问题,例如输出所有子集,所有序列,我们把这些题当作dfs的基础。Subset I, IICombinationPermutation I, IICombination Co

2013-06-24 08:07:00 43376 1

原创 Leetcode: Palindrome Partitioning I & II

Problem I : Palindrome Partitioning I Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For exam

2013-06-26 14:08:36 5592 2

原创 Leetcode Word Search

Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically

2013-06-24 13:18:22 2903 1

原创 Leetcode Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'. You may assume that there will be only one unique solution.A sudoku puzzle...

2013-06-24 08:35:21 5460 3

原创 Leetcode: N Queen I & II

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

2013-06-24 08:33:15 8526 2

原创 Leetcode Surrounded Regions

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 XX

2013-06-24 08:30:25 3572 4

原创 Leetcode Restore IP Address

Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example: Given "25525511135", return ["255.255.11.135", "255.255.111.35"].(Order d

2013-06-24 08:26:37 11055 3

原创 Leetcode: Combination of a Phone Number

Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit

2013-06-24 08:24:52 2705

原创 Leetcode 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: "((()))", "(()())", "(())()", "()(())", "()()()"

2013-06-24 08:23:13 4891 1

原创 Leetcode Combination Sum I & II

Problem 1: Combination Sum IGiven 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 c

2013-06-24 08:20:15 3967 1

原创 Leetcode Permutation I & II

Problem 1: Permutation IGiven a collection of numbers, return all possible permutations.For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [

2013-06-24 08:14:59 5295 1

原创 Leetcode Subset I & II

Problem 1: Subset IGiven a set of distinct integers, S, return all possible subsets.Note: Elements in a subset must be in non-descending order. The solution set must not contain duplicate subs

2013-06-24 08:10:13 18813 4

空空如也

空空如也

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

TA关注的人

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