随笔分类 -  LeetCode

1 2 3 4 5 ··· 8 下一页
摘要:You are given an array nums which is a permutation of [0, 1, 2, ..., n - 1]. The score of any permutation of [0, 1, 2, ..., n - 1] named perm is defin 阅读全文
posted @ 2024-05-14 23:37 Review->Improve 阅读(45) 评论(0) 推荐(0)
摘要:You are given an undirected graph (the "original graph") with n nodes labeled from 0 to n - 1. You decide to subdivide each edge in the graph into a c 阅读全文
posted @ 2023-02-21 07:33 Review->Improve 阅读(41) 评论(0) 推荐(0)
摘要:You are given a 2D integer array, queries. For each queries[i], where queries[i] = [ni, ki], find the number of different ways you can place positive 阅读全文
posted @ 2023-01-06 07:22 Review->Improve 阅读(39) 评论(0) 推荐(0)
摘要:You are given a 2D integer array intervals, where intervals[i] = [lefti, righti] describes the ith interval starting at lefti and ending at righti (in 阅读全文
posted @ 2022-03-30 00:50 Review->Improve 阅读(138) 评论(0) 推荐(0)
摘要:There are n uniquely-sized sticks whose lengths are integers from 1 to n. You want to arrange the sticks such that exactly k sticks are visible from t 阅读全文
posted @ 2022-03-16 22:38 Review->Improve 阅读(85) 评论(0) 推荐(0)
摘要:Given an array nums, we call (i, j) an important reverse pair if i < j and nums[i] > 2*nums[j]. You need to return the number of important reverse pai 阅读全文
posted @ 2021-02-18 08:35 Review->Improve 阅读(194) 评论(0) 推荐(0)
摘要:You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smal 阅读全文
posted @ 2021-02-18 02:41 Review->Improve 阅读(647) 评论(0) 推荐(0)
摘要:Given a non-empty string, encode the string such that its encoded length is the shortest. The encoding rule is: k[encoded_string], where the encoded_s 阅读全文
posted @ 2021-02-17 06:06 Review->Improve 阅读(792) 评论(0) 推荐(0)
摘要:A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner. addRan 阅读全文
posted @ 2021-02-17 01:45 Review->Improve 阅读(246) 评论(0) 推荐(0)
摘要:You are given a 0-indexed integer array nums and an integer k. You are initially standing at index 0. In one move, you can jump at most k steps forwar 阅读全文
posted @ 2021-02-16 12:05 Review->Improve 阅读(604) 评论(0) 推荐(0)
摘要:Given a rows * columns matrix mat of ones and zeros, return how many submatrices have all ones. Example 1: Input: mat = [[1,0,1], [1,1,0], [1,1,0]] Ou 阅读全文
posted @ 2021-02-16 06:13 Review->Improve 阅读(849) 评论(0) 推荐(0)
摘要:Given a m * n matrix of ones and zeros, return how many square submatrices have all ones. Example 1: Input: matrix = [ [0,1,1,1], [1,1,1,1], [0,1,1,1] 阅读全文
posted @ 2021-02-12 12:01 Review->Improve 阅读(259) 评论(0) 推荐(0)
摘要:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Example 1: Input: [[1,1],[2,2],[3,3]] Output: 3 Ex 阅读全文
posted @ 2021-02-07 09:25 Review->Improve 阅读(63) 评论(0) 推荐(0)
摘要:You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the w 阅读全文
posted @ 2021-02-06 03:42 Review->Improve 阅读(146) 评论(0) 推荐(0)
摘要:You are given an array target that consists of distinct integers and another integer array arr that can have duplicates. In one operation, you can ins 阅读全文
posted @ 2021-02-06 03:18 Review->Improve 阅读(213) 评论(0) 推荐(0)
摘要:A split of an integer array is good if: The array is split into three non-empty contiguous subarrays - named left, mid, right respectively from left t 阅读全文
posted @ 2021-01-13 05:21 Review->Improve 阅读(503) 评论(0) 推荐(0)
摘要:You are given an integer array nums of even length n and an integer limit. In one move, you can replace any integer from nums with another integer bet 阅读全文
posted @ 2021-01-06 10:10 Review->Improve 阅读(314) 评论(0) 推荐(0)
摘要:An undirected graph of n nodes is defined by edgeList, where edgeList[i] = [ui, vi, disi] denotes an edge between nodes ui and vi with distance disi. 阅读全文
posted @ 2020-12-22 10:35 Review->Improve 阅读(502) 评论(0) 推荐(0)
摘要:Given an array A of integers, for each integer A[i] we need to choose either x = -K or x = K, and add x to A[i] (only once). After this process, we ha 阅读全文
posted @ 2020-12-09 12:39 Review->Improve 阅读(158) 评论(0) 推荐(0)
摘要:We have an array A of non-negative integers. For every (contiguous) subarray B = [A[i], A[i+1], ..., A[j]] (with i <= j), we take the bitwise OR of al 阅读全文
posted @ 2020-12-05 03:41 Review->Improve 阅读(134) 评论(0) 推荐(0)

1 2 3 4 5 ··· 8 下一页