- 博客(19)
- 收藏
- 关注
原创 Greedy Algorithm 和 Hill Algorithm解决Capacitated Facility Location Problem
Capacitated Facility Location Problem:Suppose there are n facilities and m customers. We wish to choose:(1) which of the n facilities to open(2)the assignment of customers to facilities(3)The ...
2018-12-23 21:37:07 434
原创 LeetCode刷题之 Plus One
Plus OneGiven a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, and ea...
2018-12-25 00:30:25 153 1
原创 LeetCode刷题之 N-Queens
N-QueensThe 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 pu...
2018-12-25 00:23:58 148
原创 LeetCode刷题之 Subsets
SubsetsGiven a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:[ ...
2018-12-25 00:04:44 108
原创 LeetCode刷题之 Subsets II
Subsets IIGiven a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Inp...
2018-12-24 13:52:05 97
原创 LeetCode刷题之 Merge k Sorted Lists
Merge k Sorted ListsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.将k个已排好序的链表合并为一个非下降排序的链表。Example:Input:[ 1->4->5, 1->3->...
2018-12-24 13:46:34 89
原创 LeetCode刷题之 Combination Sum II
Combination Sum IIGiven a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.Each numb...
2018-12-24 00:51:09 118
原创 LeetCode刷题之 Combination Sum
Combination SumGiven a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target....
2018-12-24 00:46:10 127
原创 LeetCode刷题之 Merge k Sorted Lists
Merge k Sorted Lists说明:将多个已经排序好的链表合并成一个有序的链表。Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3-&g...
2018-12-24 00:38:43 102
原创 LeetCode刷题之 Rotate Image
Rotate ImageYou are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify the inp...
2018-12-24 00:32:45 74
原创 LeetCode刷题之 Sudoku Solver
Sudoku Solver:Write a program to solve a Sudoku puzzle by filling the empty cells.A sudoku solution must satisfy all of the following rules:Each of the digits 1-9 must occur exactly once in each...
2018-12-24 00:27:32 143
原创 LeetCode刷题之 Valid Sudoku
Valid SudokuDetermine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each row must contain the digits 1-9 without repetition. Each col...
2018-12-24 00:20:44 83
原创 LeetCode刷题之 Valid Parentheses
Valid ParenthesesGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by...
2018-12-24 00:13:46 127
原创 LeetCode刷题之 Longest Valid Parentheses
Longest Valid ParenthesesGiven a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: "(()"Output: 2Exp...
2018-12-24 00:09:15 88
原创 LeetCode刷题之 Add Two Numbers
Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and r...
2018-12-23 23:41:43 96
原创 LeetCode刷题之 String to Integer (atoi)
String to Integer (atoi)Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is foun...
2018-12-23 23:36:03 94
原创 LeetCode刷题之 Two Sum
LeetCode刷题之 Two Sum问题描述:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, a...
2018-12-23 23:20:12 92
原创 LeetCode刷题之 Pow(x, n)
Pow(x, n)题目:Implement pow(x, n).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100answer:简要:利用递归就可以解决了class Solution {public: double...
2018-12-23 23:05:08 160
转载 使用CSDN-markdown编辑器
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I ...
2018-09-11 16:40:20 71
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人