- 博客(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 402
原创 LeetCode刷题之 Plus One
Plus One Given 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 118 1
原创 LeetCode刷题之 N-Queens
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 pu...
2018-12-25 00:23:58 120
原创 LeetCode刷题之 Subsets
Subsets Given 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 93
原创 LeetCode刷题之 Subsets II
Subsets II Given 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 86
原创 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. 将k个已排好序的链表合并为一个非下降排序的链表。 Example: Input: [ 1->4->5, 1->3->...
2018-12-24 13:46:34 78
原创 LeetCode刷题之 Combination Sum II
Combination Sum II Given 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 88
原创 LeetCode刷题之 Combination Sum
Combination Sum Given 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 108
原创 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 82
原创 LeetCode刷题之 Rotate Image
Rotate Image You 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 63
原创 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 125
原创 LeetCode刷题之 Valid Sudoku
Valid Sudoku Determine 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 74
原创 LeetCode刷题之 Valid Parentheses
Valid Parentheses Given 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 117
原创 LeetCode刷题之 Longest Valid Parentheses
Longest Valid Parentheses Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example 1: Input: "(()" Output: 2 Exp...
2018-12-24 00:09:15 69
原创 LeetCode刷题之 Add Two Numbers
Add Two Numbers You 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 90
原创 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 84
原创 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 83
原创 LeetCode刷题之 Pow(x, n)
Pow(x, n) 题目: Implement pow(x, n). Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: Input: 2.10000, 3 Output: 9.26100 answer: 简要:利用递归就可以解决了 class Solution { public: double...
2018-12-23 23:05:08 136
转载 使用CSDN-markdown编辑器
欢迎使用Markdown编辑器写博客 本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦: Markdown和扩展Markdown简洁的语法 代码块高亮 图片链接和图片上传 LaTex数学公式 UML序列图和流程图 离线写博客 导入导出Markdown文件 丰富的快捷键 快捷键 加粗 Ctrl + B 斜体 Ctrl + I ...
2018-09-11 16:40:20 65
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人