随笔分类 -  LeetCode

1 2 下一页

摘要:给你一个字符串 s 和一个字符串数组 dictionary 作为字典,找出并返回字典中最长的字符串,该字符串可以通过删除 s 中的某些字符得到。 如果答案不止一个,返回长度最长且字典序最小的字符串。如果答案不存在,则返回空字符串。 来源:力扣(LeetCode)链接:https://leetcode 阅读全文

posted @ 2021-07-07 13:42 Jain_Shaw 阅读(97) 评论(0) 推荐(0)

摘要:给定一个区间的集合,找到需要移除区间的最小数量,使剩余区间互不重叠。 注意: 可以认为区间的终点总是大于它的起点。区间 [1,2] 和 [2,3] 的边界相互“接触”,但没有相互重叠。 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/non-ov 阅读全文

posted @ 2021-07-02 17:30 Jain_Shaw 阅读(30) 评论(0) 推荐(0)

摘要:给你一个字符串 s 、一个字符串 t 。返回 s 中涵盖 t 所有字符的最小子串。如果 s 中不存在涵盖 t 所有字符的子串,则返回空字符串 "" 。 注意:如果 s 中存在这样的子串,我们保证它是唯一的答案。 示例 1: 输入:s = "ADOBECODEBANC", t = "ABC"输出:"B 阅读全文

posted @ 2021-04-30 16:49 Jain_Shaw 阅读(82) 评论(0) 推荐(0)

摘要:老师想给孩子们分发糖果,有 N 个孩子站成了一条直线,老师会根据每个孩子的表现,预先给他们评分。 你需要按照以下要求,帮助老师给这些孩子分发糖果: 每个孩子至少分配到 1 个糖果。评分更高的孩子必须比他两侧的邻位孩子获得更多的糖果。那么这样下来,老师至少需要准备多少颗糖果呢? 来源:力扣(LeetC 阅读全文

posted @ 2021-04-15 01:05 Jain_Shaw 阅读(60) 评论(0) 推荐(0)

摘要:Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutati 阅读全文

posted @ 2020-09-09 10:43 Jain_Shaw 阅读(194) 评论(0) 推荐(0)

摘要:Given a string s and an integer k. Return the maximum number of vowel letters in any substring of s with length k. Vowel letters in English are (a, e, 阅读全文

posted @ 2020-09-08 10:03 Jain_Shaw 阅读(157) 评论(0) 推荐(0)

摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文

posted @ 2020-08-31 13:31 Jain_Shaw 阅读(171) 评论(0) 推荐(0)

摘要:Description Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connec 阅读全文

posted @ 2020-05-29 10:41 Jain_Shaw 阅读(134) 评论(0) 推荐(0)

摘要:Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than 阅读全文

posted @ 2020-04-23 11:07 Jain_Shaw 阅读(106) 评论(0) 推荐(0)

摘要:给定一个数组 nums,有一个大小为 k 的滑动窗口从数组的最左侧移动到数组的最右侧。你只可以看到在滑动窗口内的 k 个数字。滑动窗口每次只向右移动一位。 返回滑动窗口中的最大值。 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/sliding- 阅读全文

posted @ 2020-04-20 20:15 Jain_Shaw 阅读(198) 评论(0) 推荐(0)

摘要:Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't 阅读全文

posted @ 2019-12-21 13:41 Jain_Shaw 阅读(110) 评论(0) 推荐(0)

摘要:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文

posted @ 2019-12-16 20:47 Jain_Shaw 阅读(123) 评论(0) 推荐(0)

摘要:Count the number of prime numbers less than a non-negative number, n. Example: Input: 10Output: 4Explanation: There are 4 prime numbers less than 10, 阅读全文

posted @ 2019-12-04 22:46 Jain_Shaw 阅读(238) 评论(0) 推荐(0)

摘要:Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文

posted @ 2019-11-13 22:57 Jain_Shaw 阅读(189) 评论(0) 推荐(0)

摘要:Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp 阅读全文

posted @ 2019-10-16 21:16 Jain_Shaw 阅读(140) 评论(0) 推荐(0)

摘要:Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length. Do not allocate extra 阅读全文

posted @ 2019-10-05 00:11 Jain_Shaw 阅读(242) 评论(0) 推荐(0)

摘要:Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. Example: Input: 3Output:[ [ 1, 2, 3 ], [ 8, 9, 阅读全文

posted @ 2019-09-24 21:32 Jain_Shaw 阅读(139) 评论(0) 推荐(0)

摘要:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Input:[ [ 1, 2, 3 ], [ 4, 5, 6 ], 阅读全文

posted @ 2019-09-22 14:50 Jain_Shaw 阅读(159) 评论(0) 推荐(0)

摘要:Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the or 阅读全文

posted @ 2019-09-15 22:58 Jain_Shaw 阅读(191) 评论(0) 推荐(0)

摘要:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文

posted @ 2019-09-14 02:49 Jain_Shaw 阅读(1035) 评论(0) 推荐(0)

1 2 下一页

导航