- 博客(21)
- 资源 (6)
- 收藏
- 关注
原创 算法分析与设计课程(19):【leetcode】Ugly Number II
Description: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequ
2017-07-04 22:25:18
290
原创 第八章课后题答案
8.1. Optimization versus search. Recall the traveling salesman problem: TSP Input: A matrix of distances; a budget b Output: A tour which passes through all the cities and has length ≤ b, if suc
2017-07-01 15:02:18
1118
原创 算法分析与设计课程(18):【leetcode】Clone Graph
Description: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbours. OJ’s undirected graph serialization: Nodes are labeled uniquely. We use # as a separato
2017-06-27 16:22:46
307
原创 算法分析与设计课程(17):【leetcode】4Sum
Description: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
2017-06-16 17:00:40
266
原创 算法分析与设计课程(16):【leetcode】 Integer to Roman
Description: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. Subscribe to see which companies asked this question. 算法分析:
2017-06-11 19:47:36
277
原创 算法分析与设计课程(15):【leetcode】 Find Minimum in Rotated Sorted Array
Description: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element.
2017-06-05 15:57:08
243
原创 算法分析与设计课程(14):【leetcode】 Maximal Square
Description: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1
2017-05-25 15:20:45
292
原创 算法分析与设计课程(13):【leetcode】 Product of Array Except Self
Description: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Solve it without d
2017-05-19 14:16:55
322
原创 算法分析与设计课程(12):【leetcode】 Count Complete Tree Nodes
Description: Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia: In a complete binary tree every level, except possibly the last, is comp
2017-05-13 16:06:30
381
原创 算法分析与设计课程(11):【leetcode】Gray Code
Description: The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total number of bits in the code, prin
2017-05-04 15:54:44
353
原创 算法分析与设计课程(10):【leetcode】Simplify Path
Description: 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. 算法分析:
2017-04-30 16:23:46
258
原创 算法分析与设计课程(9):【leetcode】Jump Game
Description: 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
2017-04-23 19:55:00
283
原创 算法分析与设计课程(8):【leetcode】Sudoku Solver
Description: 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.
2017-04-14 09:15:49
333
原创 算法分析与设计课程(7):【leetcode】Reverse Nodes in k-Group
Description: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked lis
2017-04-07 14:57:33
309
原创 算法分析与设计课程(6):【leetcode】Sudoku
Description: The Sudoku board could be partially filled, where empty cells are filled with the character '.'. A partially filled sudoku which is valid. Note: A valid Sudoku board (partially
2017-03-30 11:18:41
333
原创 算法分析与设计课程(5):【leetcode】Search for a Range
Description: Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(
2017-03-26 12:03:44
295
原创 算法分析与设计课程(4):【leetcode】Wildcard Matching
Description: Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The match
2017-03-17 15:44:27
292
原创 算法分析与设计课程(3):【leetcode】Permutations
Permutations Description: Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: 算法分析:解决这个问题,很容易想到树,一层层地生成。
2017-03-09 18:20:23
272
原创 算法分析与设计课程(2):Letter Combinations of a Phone Number
Description: 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. Inpu
2017-03-03 15:41:55
238
原创 算法分析与设计课程(1):Add Two Numbers
Description: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numb
2017-02-26 18:03:20
418
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅