随笔分类 -  LeetCode

上一页 1 2 3 4 5 6 ··· 61 下一页
摘要:Given an integer num, return the number of steps to reduce it to zero. In one step, if the current number is even, you have to divide it by 2, otherwi 阅读全文
posted @ 2023-04-25 14:02 Grandyang 阅读(126) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers arr and an integer d. In one step you can jump from index i to index: i + x where: i + x < arr.length and 0 < x <= d. i - x 阅读全文
posted @ 2023-04-14 13:16 Grandyang 阅读(232) 评论(0) 推荐(0) 编辑
摘要:Given the root of a binary tree, split the binary tree into two subtrees by removing one edge such that the product of the sums of the subtrees is max 阅读全文
posted @ 2023-04-05 13:42 Grandyang 阅读(108) 评论(0) 推荐(0) 编辑
摘要:You are given an integer array arr. You can choose a set of integers and remove all the occurrences of these integers in the array. Return the minimum 阅读全文
posted @ 2023-04-02 08:13 Grandyang 阅读(106) 评论(0) 推荐(0) 编辑
摘要:You are given an m x n binary matrix mat of 1's (representing soldiers) and 0's (representing civilians). The soldiers are positioned in front of the 阅读全文
posted @ 2023-03-27 10:40 Grandyang 阅读(184) 评论(0) 推荐(0) 编辑
摘要:You want to schedule a list of jobs in d days. Jobs are dependent (i.e To work on the ith job, you have to finish all the jobs j where 0 <= j < i). Yo 阅读全文
posted @ 2023-03-20 07:27 Grandyang 阅读(277) 评论(0) 推荐(0) 编辑
摘要:There are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional and weighted edge b 阅读全文
posted @ 2023-03-15 14:04 Grandyang 阅读(156) 评论(0) 推荐(0) 编辑
摘要:Given the array restaurants where restaurants[i] = [idi, ratingi, veganFriendlyi, pricei, distancei]. You have to filter the restaurants using three f 阅读全文
posted @ 2023-02-27 09:15 Grandyang 阅读(100) 评论(0) 推荐(0) 编辑
摘要:You are given a string s consisting only of letters 'a' and 'b'. In a single step you can remove one palindromic subsequence from s. Return the minimu 阅读全文
posted @ 2023-02-25 12:25 Grandyang 阅读(123) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers arr, replace each element with its rank. The rank represents how large the element is. The rank has the following rules: Ra 阅读全文
posted @ 2023-02-19 09:20 Grandyang 阅读(125) 评论(0) 推荐(0) 编辑
摘要:You are given an integer array nums. The value of this array is defined as the sum of |nums[i] - nums[i + 1]| for all 0 <= i < nums.length - 1. You ar 阅读全文
posted @ 2023-02-14 11:14 Grandyang 阅读(110) 评论(0) 推荐(0) 编辑
摘要:A matrix diagonal is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom-right direc 阅读全文
posted @ 2023-01-30 13:56 Grandyang 阅读(127) 评论(0) 推荐(0) 编辑
摘要:Given a palindromic string of lowercase English letters palindrome, replace exactly one character with any lowercase English letter so that the result 阅读全文
posted @ 2023-01-17 02:49 Grandyang 阅读(191) 评论(0) 推荐(0) 编辑
摘要:There is a one-dimensional garden on the x-axis. The garden starts at the point 0 and ends at the point n. (i.e The length of the garden is n). There 阅读全文
posted @ 2023-01-12 14:16 Grandyang 阅读(238) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target,  阅读全文
posted @ 2023-01-03 19:16 Grandyang 阅读(133) 评论(0) 推荐(0) 编辑
摘要:Given a string s. Return all the words vertically in the same order in which they appear in s. Words are returned as a list of strings, complete with  阅读全文
posted @ 2022-12-10 20:02 Grandyang 阅读(101) 评论(0) 推荐(0) 编辑
摘要:You are given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can get by changing at most one digit (6* become 阅读全文
posted @ 2022-12-04 07:44 Grandyang 阅读(134) 评论(0) 推荐(0) 编辑
摘要:You have a keyboard layout as shown above in the X-Y plane, where each English uppercase letter is located at some coordinate. For example, the letter 阅读全文
posted @ 2022-11-21 04:00 Grandyang 阅读(847) 评论(0) 推荐(0) 编辑
摘要:There are n computers numbered from 0 to n - 1 connected by ethernet cables connections forming a network where connections[i] = [ai, bi] represents a 阅读全文
posted @ 2022-11-07 15:31 Grandyang 阅读(735) 评论(0) 推荐(0) 编辑
摘要:Given 3 positives numbers a, b and c. Return the minimum flips required in some bits of a and b to make ( a OR b == c ). (bitwise OR operation). Flip 阅读全文
posted @ 2022-10-17 04:00 Grandyang 阅读(265) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 61 下一页
Fork me on GitHub