摘要:
終于將LeetCode的大部分題刷完了,真是漫長的第一遍啊,估計很多題都忘的差不多了,這次開個題目匯總貼,并附上每道題目的解題連接,方便之后查閱吧~ 博主還制作了一款 網頁版APP,方便大家進行查閱,網址如下: https://grandyang.com 對應的 Github 項目 的同步地址如下,
閱讀全文
posted @ 2015-06-28 23:20
Grandyang
閱讀(1323355)
推薦(116)
摘要:
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
閱讀(52)
推薦(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
閱讀(50)
推薦(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
閱讀(125)
推薦(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
閱讀(167)
推薦(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
閱讀(206)
推薦(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
閱讀(159)
推薦(0)
摘要:
Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the num
閱讀全文
posted @ 2024-05-29 23:07
Grandyang
閱讀(121)
推薦(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
閱讀(227)
推薦(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
閱讀(118)
推薦(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
閱讀(235)
推薦(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
閱讀(149)
推薦(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
閱讀(121)
推薦(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
閱讀(216)
推薦(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
閱讀(103)
推薦(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
閱讀(140)
推薦(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
閱讀(86)
推薦(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
閱讀(341)
推薦(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
閱讀(1352)
推薦(0)
摘要:
Given a `m x n` matrix `grid` which is sorted in non-increasing order both row-wise and column-wise, return *the number of **negative** numbers in* `g
閱讀全文
posted @ 2023-08-06 00:40
Grandyang
閱讀(478)
推薦(0)
摘要:
Given a `m * n` matrix `seats` that represent seats distributions in a classroom. If a seat is broken, it is denoted by `'#'` character otherwise it i
閱讀全文
posted @ 2023-07-21 15:02
Grandyang
閱讀(412)
推薦(0)
摘要:
A social media company is trying to monitor activity on their site by analyzing the number of tweets that occur in select periods of time. These perio
閱讀全文
posted @ 2023-06-14 14:10
Grandyang
閱讀(274)
推薦(0)
摘要:
You are given two strings of the same length `s` and `t`. In one step you can choose **any character** of `t` and replace it with **another character*
閱讀全文
posted @ 2023-06-05 23:44
Grandyang
閱讀(266)
推薦(0)
摘要:
Given an array `arr` of integers, check if there exist two indices `i` and `j` such that : - `i != j` - `0 這道題給了一個整型數(shù)組,讓檢測是否有一個數(shù)字和其倍數(shù)同時存在的情況。一看到這道題博主就
閱讀全文
posted @ 2023-06-05 02:00
Grandyang
閱讀(258)
推薦(0)
摘要:
Given an array of integers `arr`, you are initially positioned at the first index of the array. In one step you can jump from index `i` to index: - `i
閱讀全文
posted @ 2023-06-04 00:44
Grandyang
閱讀(386)
推薦(0)
摘要:
Given two numbers, `hour` and `minutes`, return *the smaller angle (in degrees) formed between the *`hour`* and the *`minute`* hand*. Answers within `
閱讀全文
posted @ 2023-05-24 14:50
Grandyang
閱讀(213)
推薦(0)
摘要:
Given an array of integers arr and two integers k and threshold, return *the number of sub-arrays of size k and average greater than or equal to *thre
閱讀全文
posted @ 2023-05-16 12:36
Grandyang
閱讀(228)
推薦(0)
摘要:
When use crontab to schedule job running on Mac/Linux, you might have the following error: python3: can't open file 'p.py': [Errno 1] Operation not pe
閱讀全文
posted @ 2023-05-11 15:05
Grandyang
閱讀(389)
推薦(0)
摘要:
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
閱讀(238)
推薦(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
閱讀(374)
推薦(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
閱讀(226)
推薦(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
閱讀(216)
推薦(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
閱讀(291)
推薦(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
閱讀(424)
推薦(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
閱讀(372)
推薦(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
閱讀(159)
推薦(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
閱讀(223)
推薦(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
閱讀(248)
推薦(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
閱讀(216)
推薦(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
閱讀(311)
推薦(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
閱讀(325)
推薦(0)