- 博客(91)
- 收藏
- 关注
转载 判断点是否落在多边形内部的算法
原文地址:http://www.cnblogs.com/mazhenyu/archive/2010/06/13/1757855.html
2014-09-27 00:58:53 1191
转载 给力!高效!易懂!位运算求组合
原帖地址:http://blog.csdn.net/w57w57w57/article/details/6657547
2014-09-16 21:47:44 870
原创 LeetCode OJ算法题(八十三):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.Gi
2014-08-27 15:05:45 436
原创 LeetCode OJ算法题(八十二):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.解法:Remove Dupl
2014-08-27 14:58:55 392
原创 LeetCode OJ算法题(八十一):Search in Rotated Sorted Array II
题目:Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target
2014-08-27 14:43:16 402
原创 LeetCode OJ算法题(八十):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 no
2014-08-27 14:37:24 383
原创 LeetCode OJ算法题(七十九):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 v
2014-08-27 14:27:43 435
原创 LeetCode OJ算法题(七十八):Subsets
题目:Given 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 subsets.
2014-08-27 14:22:54 464
原创 LeetCode OJ算法题(七十七):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],
2014-08-27 14:19:30 473
原创 LeetCode OJ算法题(七十六):Minimum Window Substring
题目:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum windo
2014-08-27 14:05:54 475
原创 LeetCode OJ算法题(七十五):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
2014-08-27 13:56:50 502
原创 LeetCode OJ算法题(七十四):Search a 2D Matrix
题目:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first intege
2014-08-27 13:49:44 456
原创 LeetCode OJ算法题(七十三):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
2014-08-27 13:34:27 618
原创 LeetCode OJ算法题(七十二):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 o
2014-08-27 12:58:56 811
原创 LeetCode OJ算法题(七十一):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:
2014-08-27 12:51:12 645
原创 LeetCode OJ算法题(七十):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?解法:采用DP算法,找到递推关系式。
2014-08-27 12:47:56 478
原创 LeetCode OJ算法题(六十九):Sqrt(x)
题目:mplement int sqrt(int x).Compute and return the square root of x.解法:和前面的不用che
2014-08-27 12:39:32 432
原创 LeetCode OJ算法题(六十八):Text Justification
题目:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy approac
2014-08-27 12:27:37 600
原创 LeetCode OJ算法题(六十七):Plus One
题目:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.解法:
2014-08-26 22:26:59 463
原创 LeetCode OJ算法题(六十六):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 b
2014-08-26 22:11:03 683
原创 LeetCode OJ算法题(六十五):Add Binary
题目:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".解法:
2014-08-26 22:01:57 421
原创 LeetCode OJ算法题(六十四):Merge Two Sorted Lists
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.解法:实际上就是归并排序的lian
2014-08-26 21:51:37 376
原创 LeetCode OJ算法题(六十三):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.解法:
2014-08-26 21:46:36 442
原创 LeetCode OJ算法题(六十二):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
2014-08-26 21:36:03 385
原创 LeetCode OJ算法题(六十一):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 r
2014-08-26 21:27:15 433
原创 LeetCode OJ算法题(六十):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-26 21:17:31 493
转载 在无循环、条件判断、乘除法的条件下求和
原帖地址:http://www.itmian4.com/forum.php?mod=viewthread&tid=5907&fromuid=106题目:求1+2+…+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字以及条件判断语句(A?B:C)。分析:这道题没有多少实际意义,因为在软件开发中不会有这么变态的限制。但这道题却能有效地考查发散思
2014-08-26 14:41:08 527
转载 排序算法简单比较
1.稳定性比较插入排序、冒泡排序、二叉树排序、二路归并排序及其他线形排序是稳定的选择排序、希尔排序、快速排序、堆排序是不稳定的2.时间复杂性比较 平均情况 最好情况最坏情况归并排序O(nlogn) O(nlogn)O(nlogn)基数排序O(n)O(n)O(n)快
2014-08-23 22:02:52 388
原创 LeetCode OJ算法题(五十九):Permutation Sequence
题目:The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""21
2014-08-08 21:39:05 438
原创 LeetCode OJ算法题(五十八):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
2014-08-08 21:31:26 478
原创 LeetCode OJ算法题(五十七):Length of Last Word
题目:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note:
2014-08-08 21:29:03 327
原创 LeetCode OJ算法题(五十六):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 ti
2014-08-08 21:20:57 430
原创 LeetCode OJ算法题(五十五):Merge Intervals
题目:Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].解法:timu
2014-08-08 21:12:14 468
原创 LeetCode OJ算法题(五十四):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.De
2014-08-07 21:06:09 400
原创 LeetCode OJ算法题(五十三):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
2014-08-07 20:59:03 395
原创 LeetCode OJ算法题(五十二):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 subarra
2014-08-07 20:53:01 413
原创 LeetCode OJ算法题(五十一):N Queens II
题目:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.解法:jiefa
2014-08-07 20:48:09 394
原创 LeetCode OJ算法题(五十):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
2014-08-07 20:39:30 437
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人