随笔分类 -  LeetCode

1 2 3 4 5 ··· 61 下一页
摘要:You have a 1-indexed binary string of length n where all the bits are 0 initially. We will flip all the bits of this binary string (i.e., change them 阅读全文
posted @ 2026-08-29 11:01 Grandyang 阅读(1) 评论(0) 推荐(0)
摘要:Given an integer n, return a string with n characters such that each character in such string occurs an odd number of times. The returned string must 阅读全文
posted @ 2026-08-26 18:09 Grandyang 阅读(5) 评论(0) 推荐(0)
摘要:Given a binary tree `root`, return *the maximum sum of all keys of any sub-tree which is also a Binary Search Tree (BST)*. Assume a BST is defined as 阅读全文
posted @ 2026-08-23 16:01 Grandyang 阅读(8) 评论(0) 推荐(0)
摘要:You are given the root of a binary tree. A ZigZag path for a binary tree is defined as follow: Choose any node in the binary tree and a direction (rig 阅读全文
posted @ 2025-08-02 09:56 Grandyang 阅读(133) 评论(0) 推荐(0)
摘要:Given the string s, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' must 阅读全文
posted @ 2025-05-27 21:07 Grandyang 阅读(90) 评论(0) 推荐(0)
摘要:You are given a string s. Reorder the string using the following algorithm: Remove the smallest character from s and append it to the result. Remove t 阅读全文
posted @ 2025-01-18 19:26 Grandyang 阅读(166) 评论(0) 推荐(0)
摘要:Given an m x n grid. Each cell of the grid has a sign pointing to the next cell you should visit if you are currently in this cell. The sign of grid[i 阅读全文
posted @ 2024-12-11 22:18 Grandyang 阅读(246) 评论(0) 推荐(0)
摘要:Given a binary tree root and a linked list with head as the first node. Return True if all the elements in the linked list starting from the head corr 阅读全文
posted @ 2024-08-18 15:23 Grandyang 阅读(288) 评论(0) 推荐(0)
摘要:In a special ranking system, each voter gives a rank from highest to lowest to all teams participating in the competition. The ordering of teams is de 阅读全文
posted @ 2024-07-06 22:53 Grandyang 阅读(221) 评论(0) 推荐(0)
摘要:Given an array of digits digits, return the largest multiple of three that can be formed by concatenating some of the given digits in any order. If th 阅读全文
posted @ 2024-01-11 13:43 Grandyang 阅读(281) 评论(0) 推荐(0)
摘要:Given an integer num, find the closest two integers in absolute difference whose product equals num + 1 or num + 2. Return the two integers in any ord 阅读全文
posted @ 2023-12-21 09:51 Grandyang 阅读(152) 评论(0) 推荐(0)
摘要:You have n binary tree nodes numbered from 0 to n - 1 where node i has two children leftChild[i] and rightChild[i], return true if and only if all the 阅读全文
posted @ 2023-11-20 09:38 Grandyang 阅读(286) 评论(0) 推荐(0)
摘要:Write a program to count the number of days between two dates. The two dates are given as strings, their format is YYYY-MM-DD as shown in the examples 阅读全文
posted @ 2023-11-12 12:18 Grandyang 阅读(200) 评论(0) 推荐(0)
摘要:Given n orders, each order consists of a pickup and a delivery service. Count all valid pickup/delivery possible sequences such that delivery(i) is al 阅读全文
posted @ 2023-11-06 08:02 Grandyang 阅读(162) 评论(0) 推荐(0)
摘要:Given a string s consisting only of characters a, b and c. Return the number of substrings containing at least one occurrence of all these characters  阅读全文
posted @ 2023-10-30 05:48 Grandyang 阅读(271) 评论(0) 推荐(0)
摘要:There is a supermarket that is frequented by many customers. The products sold at the supermarket are represented as two parallel integer arrays produ 阅读全文
posted @ 2023-10-29 02:29 Grandyang 阅读(149) 评论(0) 推荐(0)
摘要:You are given an integer array arr. Sort the integers in the array in ascending order by the number of 1's in their binary representation and in case 阅读全文
posted @ 2023-10-22 01:07 Grandyang 阅读(189) 评论(0) 推荐(0)
摘要:You are given an array target of n integers. From a starting array arr consisting of n 1's, you may perform the following procedure : let x be the sum 阅读全文
posted @ 2023-10-15 07:48 Grandyang 阅读(151) 评论(0) 推荐(0)
摘要:You are given an array of events where events[i] = [startDayi, endDayi]. Every event i starts at startDayi and ends at endDayi. You can attend an even 阅读全文
posted @ 2023-09-25 10:22 Grandyang 阅读(392) 评论(0) 推荐(0)
摘要:Design an algorithm that accepts a stream of integers and retrieves the product of the last k integers of the stream. Implement the ProductOfNumbers c 阅读全文
posted @ 2023-09-14 12:54 Grandyang 阅读(1562) 评论(0) 推荐(0)

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