全站内容
easy
125. Valid Palindrome
#Problem A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. …
3206. Alternating Groups I
#Problem There is a circle of red and blue tiles. You are given an array of integers colors. The color of tile i is represented by colors[i]: colors[i] == 0 means that tile i is red. colors[i] == 1 means that tile i is blue. Every 3 …
121. Best Time to Buy and Sell Stock
#Problem You are given an array prices where prices[i] is the price of a given stock on the iᵗʰ day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. …
242. Valid Anagram
#Problem Given two strings s and t, return true if t is an anagram of s, and false otherwise. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, using all the original letters exactly once. …
104. Maximum Depth of Binary Tree
#Problem Given the root of a binary tree, return its maximum depth. A binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. …
100. Same Tree
#Problem Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. …
226. Invert Binary Tree
#Problem Given the root of a binary tree, invert the tree, and return its root. https://leetcode.com/problems/invert-binary-tree/ Example 1: case1Input: root = [4,2,7,1,3,6,9] Output: [4,7,2,9,6,3,1] Example 2: case2Input: root = …
217. Contains Duplicate
#Problem Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. https://leetcode.com/problems/contains-duplicate/ Example 1: Input: nums = [1,2,3,1] Output: …
3238. Find the Number of Winning Players
#Problem You are given an integer n representing the number of players in a game and a 2D array pick where pick[i] = [xᵢ, yᵢ] represents that the player xᵢ picked a ball of color yᵢ. Player i wins the game if they pick strictly more than i …
338. Counting Bits
#Problem Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1’s in the binary representation of i. https://leetcode.com/problems/counting-bits/ Example 1: Input: n = 2 Output: …