全站内容
medium
424. Longest Repeating Character Replacement
#Problem You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most k times. Return the length of the longest …
3240. Minimum Number of Flips to Make Binary Grid Palindromic II
#Problem You are given an m x n binary matrix grid. A row or column is considered palindromic if its values read the same forward and backward. You can flip any number of cells in grid from 0 to 1, or from 1 to 0. Return the minimum number …
417. Pacific Atlantic Water Flow
#Problem There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island’s left and top edges, and the Atlantic Ocean touches the island’s right and bottom edges. The island …
33. Search in Rotated Sorted Array
#Problem There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is …
153. Find Minimum in Rotated Sorted Array
#Problem Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: [4,5,6,7,0,1,2] if it was rotated 4 times. [0,1,2,4,5,6,7] if it was rotated 7 …
3239. Minimum Number of Flips to Make Binary Grid Palindromic I
#Problem You are given an m x n binary matrix grid. A row or column is considered palindromic if its values read the same forward and backward. You can flip any number of cells in grid from 0 to 1, or from 1 to 0. Return the minimum number …
152. Maximum Product Subarray
#Problem Given an integer array nums, find a subarray that has the largest product, and return the product. A subarray is a contiguous non-empty sequence of elements within an array. The test cases are generated so that the answer will fit …
19. Remove Nth Node From End of List
#Problem Given the head of a linked list, remove the nᵗʰ node from the end of the list and return its head. https://leetcode.com/problems/remove-nth-node-from-end-of-list/ Example 1: case1Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] …
143. Reorder List
#Problem You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → … You may not modify the values in the …
3249. Count the Number of Good Nodes
#Problem There is an undirected tree with n nodes labeled from 0 to n - 1, and rooted at node 0. You are given a 2D integer array edges of length n - 1, where edges[i] = [aᵢ, bᵢ] indicates that there is an edge between nodes aᵢ and bᵢ in …