CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2849. Determine if a Cell Is Reachable at a Given Time

You are given four integers sx, sy, fx, fy, and a non-negative integer t. In an infinite 2D grid, you start at the cell (sx, sy). Each second, you must move to any of its adjacent cells. Return true i
2023-11-08
#leetcode #java #math

[LeetCode] 2609. Find the Longest Balanced Substring of a Binary String

You are given a binary string s consisting only of zeroes and ones. A substring of s is considered balanced if all zeroes are before ones and the number of zeroes is equal to the number of ones inside
2023-11-07
#leetcode #two pointer #java #string

[LeetCode] 2265. Count Nodes Equal to Average of Subtree

Given the root of a binary tree, return the number of nodes where the value of the node is equal to the average of the values in its subtree. Note:The average of n elements is the sum of the n element
2023-11-06
#leetcode #java #tree #dfs #postorder

[LeetCode] 1535. Find the Winner of an Array Game

Given an integer array arr of distinct integers and an integer k. A game will be played between the first two elements of the array (i.e. arr[0] and arr[1]). In each round of the game, we compare arr[
2023-11-05
#leetcode #array #java #simulation

[LeetCode] 2149. Rearrange Array Elements by Sign

You are given a 0-indexed integer array nums of even length consisting of an equal number of positive and negative integers. You should rearrange the elements of nums such that the modified array foll
2023-11-04
#leetcode #array #two pointer #java #simulation

[LeetCode] 2558. Take Gifts From the Richest Pile

You are given an integer array gifts denoting the number of gifts in various piles. Every second, you do the following: Choose the pile with the maximum number of gifts.If there is more than one pile
2023-10-28
#leetcode #array #java #heap #simulation

[LeetCode] 2530. Maximal Score After Applying K Operations

You are given a 0-indexed integer array nums and an integer k. You have a starting score of 0. In one operation:choose an index i such that 0 <= i < nums.length,increase your score by nums[
2023-10-18
#leetcode #array #java #greedy #heap

[LeetCode] 1921. Eliminate Maximum Number of Monsters

You are playing a video game where you are defending your city from a group of n monsters. You are given a 0-indexed integer array dist of size n, where dist[i] is the initial distance in kilometers o
2023-09-03
#leetcode #array #java #greedy #sort

[LeetCode] 2337. Move Pieces to Obtain a String

You are given two strings start and target, both of length n. Each string consists only of the characters ‘L’, ‘R’, and ‘_’ where: The characters ‘L’ and ‘R’ represent pieces, where a piece ‘L’ can mo
2023-08-22
#leetcode #two pointer #java #string

[LeetCode] 1870. Minimum Speed to Arrive on Time

You are given a floating-point number hour, representing the amount of time you have to reach the office. To commute to the office, you must take n trains in sequential order. You are also given an in
2023-07-27
#leetcode #array #java #binary search #binary search on answer
1…1314151617…41

Search

Hexo Fluid