算法
文章平均质量分 80
算法解析
Vilinzz
这个作者很懒,什么都没留下…
展开
-
算法设计与分析(十一)--动态规划
1. Unique Binary Search Trees2. Unique Binary Search Trees IIUnique Binary Search Trees题目Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n?分析这题是典型的卡特兰数的例...原创 2018-11-16 19:22:14 · 216 阅读 · 0 评论 -
Unique Paths II(动态规划)
Unique Paths II题目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 tryi...原创 2018-11-04 14:28:08 · 245 阅读 · 0 评论 -
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: 2Expl...原创 2018-11-04 13:33:37 · 475 阅读 · 0 评论 -
算法设计与分析(九)--动态规划
Burst Balloons题目Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i yo...原创 2018-10-30 22:14:53 · 256 阅读 · 0 评论 -
算法设计与分析--动态规划(八)
Longest Increasing Path in a Matrix题目Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or down. You may...原创 2018-10-27 11:37:18 · 231 阅读 · 0 评论 -
算法设计与分析(七)
贪心算法题目这次我们选择两题贪心算法作为练习,这两道题目是有关系的,一个是比较基础的贪心,另一个是难一点的贪心。Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array re...原创 2018-10-18 23:46:51 · 180 阅读 · 0 评论 -
LeetCode--Keys and Rooms
Keys and Rooms题目There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, …, N-1, and each room may have some keys to access the next room.Formally, each room i has a ...原创 2018-10-14 22:20:26 · 153 阅读 · 0 评论 -
算法设计与分析(六
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->4,2->6]Output: 1->1-&gt原创 2018-10-11 19:30:11 · 151 阅读 · 0 评论 -
算法设计与分析(五)
Is Graph Bipartite?1. 题目Given an undirected graph, return true if and only if it is bipartite.Recall that a graph is bipartite if we can split it’s set of nodes into two independent subsets A and B...原创 2018-10-04 10:04:31 · 195 阅读 · 0 评论 -
算法设计与分析第四周练习(图论)
Network Delay Time1. 题目There are N network nodes, labelled 1 to N.Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v is the target node, and ...原创 2018-09-28 13:54:57 · 346 阅读 · 0 评论