CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2831. Find the Longest Equal Subarray

You are given a 0-indexed integer array nums and an integer k. A subarray is called equal if all of its elements are equal. Note that the empty subarray is an equal subarray. Return the length of the
2024-05-22
#leetcode #java #array #hashmap #sliding window

[LeetCode] 1863. Sum of All Subset XOR Totals

The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty. For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1.Given an array nums,
2024-05-19
#leetcode #dfs #java #array #backtracking #bit manipulation

[LeetCode] 1953. Maximum Number of Weeks for Which You Can Work

There are n projects numbered from 0 to n - 1. You are given an integer array milestones where each milestones[i] denotes the number of milestones the ith project has. You can work on the projects fol
2024-05-15
#leetcode #java #array #greedy

[LeetCode] 3075. Maximize Happiness of Selected Children

You are given an array happiness of length n, and a positive integer k. There are n children standing in a queue, where the ith child has happiness value happiness[i]. You want to select k children fr
2024-05-09
#leetcode #java #array #greedy #sort

[LeetCode] 2960. Count Tested Devices After Test Operations

You are given a 0-indexed integer array batteryPercentages having length n, denoting the battery percentages of n 0-indexed devices. Your task is to test each device i in order from 0 to n - 1, by per
2024-05-09
#leetcode #java #array #simulation

[LeetCode] 2105. Watering Plants II

Alice and Bob want to water n plants in their garden. The plants are arranged in a row and are labeled from 0 to n - 1 from left to right where the ith plant is located at x = i. Each plant needs
2024-05-09
#leetcode #java #array #two pointer #simulation

[LeetCode] 2079. Watering Plants

You want to water n plants in your garden with a watering can. The plants are arranged in a row and are labeled from 0 to n - 1 from left to right where the ith plant is located at x = i. There i
2024-05-07
#leetcode #java #array #greedy #simulation

[LeetCode] 2487. Remove Nodes From Linked List

You are given the head of a linked list. Remove every node which has a node with a greater value anywhere to the right side of it. Return the head of the modified linked list. Example 1:Input: head &#
2024-05-06
#leetcode #java #recursion #linked list #stack #monotonic stack

[LeetCode] 2739. Total Distance Traveled

A truck has two fuel tanks. You are given two integers, mainTank representing the fuel present in the main tank in liters and additionalTank representing the fuel present in the additional tank in lit
2024-04-24
#leetcode #java #math

[LeetCode] 2073. Time Needed to Buy Tickets

There are n people in a line queuing to buy tickets, where the 0th person is at the front of the line and the (n - 1)th person is at the back of the line. You are given a 0-indexed integer array ticke
2024-04-09
#leetcode #java #array #simulation
1…910111213…47

Search

Hexo Fluid