算法分析与设计
雾语o-o
这个作者很懒,什么都没留下…
展开
-
【算法】【Graph】Reconstruct Itinerary
Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK.原创 2017-10-07 11:40:56 · 243 阅读 · 0 评论 -
【算法】【Divide and conquer】Median of Two Sorted Arrays
Difficulty:HardDescriptionThere are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+原创 2017-09-17 18:14:45 · 460 阅读 · 0 评论 -
【算法】【Divide and conquer】Different Ways to Add Parentheses
Difficulty:MediumDescriptionGiven a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operator原创 2017-09-10 11:17:35 · 211 阅读 · 0 评论 -
【算法】【Greedy】Jump Game II
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-12-28 12:31:32 · 259 阅读 · 0 评论 -
【算法】【Greedy】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.原创 2017-12-27 18:59:21 · 214 阅读 · 0 评论 -
Prove STINGY SAT is NP-complete
证明STINGY SAT是NP完全问题。原创 2017-12-30 18:24:47 · 1038 阅读 · 0 评论 -
【算法】【Dynamic Programming】Longest Valid Parentheses
Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.原创 2017-12-03 21:56:44 · 172 阅读 · 0 评论 -
【算法】【Dynamic Programming】Wildcard Matching
Implement wildcard pattern matching with support for '?' and '*'. ‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence).原创 2017-12-21 14:37:54 · 228 阅读 · 0 评论 -
【算法】【Dynamic Programming】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 in the grid.原创 2017-11-26 13:22:41 · 184 阅读 · 0 评论 -
【算法】【Dynamic Programming】Wiggle Subsequence
A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or原创 2017-12-08 15:40:15 · 151 阅读 · 0 评论 -
【算法】【Graph】Course Schedule
There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example, to take course 0 you have to first take course 1, which is expressed as a pair: [0,1].原创 2017-10-14 10:51:34 · 186 阅读 · 0 评论 -
【算法】【Greedy】Queue Reconstruction by Height
Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of this person.原创 2017-10-21 20:55:58 · 209 阅读 · 0 评论 -
【算法】【Dynamic Programming】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.原创 2017-10-29 13:11:13 · 290 阅读 · 0 评论 -
【算法】【Greedy】Patching Array
Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be formed by the sum of some elements in the array.原创 2017-10-06 16:43:50 · 186 阅读 · 0 评论 -
【算法】【Graph】Evaluate Division
Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers.原创 2017-10-05 20:50:27 · 236 阅读 · 0 评论 -
【算法】【LRU】146. LRU缓存机制
Description设计和实现一个LRU(最近最少使用)缓存数据结构,使它应该支持以下操作: get 和 put 。get(key) - 如果密钥存在于缓存中,则获取密钥的值(值总是正数),否则返回 -1。 put(key, value) - 如果密钥不存在,请设置或插入值。当缓存达到其容量时,它应该在插入新项目之前使最近最少使用的项目作废。后续: 你是否可以在 O(1) 时间复...原创 2018-04-17 20:35:50 · 3503 阅读 · 2 评论