随笔分类 - leetcode
[Leetcode 881]船救人 Boats to Save People 贪心
摘要:【题目】 The i-th person has weight people[i], and each boat can carry a maximum weight of limit. Each boat carries at most 2 people at the same time, pro
阅读全文
[Leetcode 62]机器人走路Unique Path 动态规划
摘要:【题目】 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
阅读全文
[Leetcode 70]爬梯子 Climbing Stairs
摘要:【题目】 You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can y
阅读全文
[leetcode121]股票买卖 Best Time to Buy and Sell Kadane算法
摘要:【题目】 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transa
阅读全文
[leetcode53]最长子数组 Maximum Subarray Kadane's算法
摘要:【题目】 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example:
阅读全文
[Leetcode 44]通配符匹配Wildcard Matching
摘要:【题目】 匹配通配符*,?,DP动态规划,重点是*的两种情况 想象成两个S、P长度的字符串,P匹配S。 S中不会出现通配符。 【条件】 (1)P=null,S=null,TRUE (2)P=null,S!=null,P必然无法匹配S,FALSE。 (3)P[i]=“*” 的TRUE/FALSE状态等
阅读全文
[Leetcode 3] 最长不重复子串 Longest substring without repeating 滑动窗口
摘要:【题目】 Given a string, find the length of the longest substring without repeating characters. 【举例】 Example 1: Input: "abcabcbb" Output: 3 Explanation: T
阅读全文
[Leetcode 55]跳格子JumpGame
摘要:【题目】 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
阅读全文
[Leetcode 104]求二叉树的深度Depth of BinaryTree
摘要:【题目】 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farth
阅读全文
浙公网安备 33010602011771号