随笔分类 -  算法

本分类用于存放一些算法题,主要来源于Leetcode。
摘要:题目 Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is a sequence that can be derived from 阅读全文
posted @ 2022-04-06 17:11 frankming 阅读(26) 评论(0) 推荐(0)
摘要:题目 Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary 阅读全文
posted @ 2022-04-06 14:28 frankming 阅读(33) 评论(0) 推荐(0)
摘要:题目 An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the s 阅读全文
posted @ 2022-04-06 11:50 frankming 阅读(25) 评论(0) 推荐(0)
摘要:题目 An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the s 阅读全文
posted @ 2022-04-02 17:26 frankming 阅读(30) 评论(0) 推荐(0)
摘要:题目 Given a string s, return the longest palindromic substring in s. Example 1: Input: s = "babad" Output: "bab" Explanation: "aba" is also a valid ans 阅读全文
posted @ 2022-04-02 15:14 frankming 阅读(22) 评论(0) 推荐(0)
摘要:题目 There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom- 阅读全文
posted @ 2022-04-02 14:36 frankming 阅读(18) 评论(0) 推荐(0)
摘要:题目 Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents yo 阅读全文
posted @ 2022-04-02 14:29 frankming 阅读(38) 评论(0) 推荐(0)
摘要:题目 You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum 阅读全文
posted @ 2022-04-01 15:45 frankming 阅读(31) 评论(0) 推荐(0)
摘要:题目 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are 阅读全文
posted @ 2022-03-31 20:15 frankming 阅读(27) 评论(0) 推荐(0)
摘要:题目 Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequ 阅读全文
posted @ 2022-03-31 17:34 frankming 阅读(60) 评论(0) 推荐(0)
摘要:题目 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))"," 阅读全文
posted @ 2022-03-30 17:24 frankming 阅读(26) 评论(0) 推荐(0)
摘要:题目 Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate n 阅读全文
posted @ 2022-03-30 15:14 frankming 阅读(42) 评论(0) 推荐(0)
摘要:题目 Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in 阅读全文
posted @ 2022-03-29 18:57 frankming 阅读(24) 评论(0) 推荐(0)
摘要:题目 Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen 阅读全文
posted @ 2022-03-29 10:38 frankming 阅读(43) 评论(0) 推荐(0)
摘要:题目 Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Example 1: Input: nums = 阅读全文
posted @ 2022-03-28 20:13 frankming 阅读(27) 评论(0) 推荐(0)
摘要:题目 Given an integer array nums that may contain duplicates, return all possible subsets (the power set). The solution set must not contain duplicate s 阅读全文
posted @ 2022-03-28 16:36 frankming 阅读(26) 评论(0) 推荐(0)
摘要:题目 Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. R 阅读全文
posted @ 2022-03-28 14:43 frankming 阅读(22) 评论(0) 推荐(0)
摘要:题目 Given a directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, find all possible paths from node 0 to node n - 1 and return them in any o 阅读全文
posted @ 2022-03-28 14:12 frankming 阅读(33) 评论(0) 推荐(0)
摘要:题目 Given an m x n matrix board containing 'X' and 'O', capture all regions that are 4-directionally surrounded by 'X'. A region is captured by flippin 阅读全文
posted @ 2022-03-28 13:52 frankming 阅读(28) 评论(0) 推荐(0)
摘要:题目 Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1. A clear path i 阅读全文
posted @ 2022-03-24 23:55 frankming 阅读(60) 评论(0) 推荐(0)