CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2196. Create Binary Tree From Descriptions

You are given a 2D integer array descriptions where descriptions[i] = [parenti, childi, isLefti] indicates that parenti is the parent of childi in a binary tree of unique values. Furthermore,If i
2024-07-16
#leetcode #tree #java #array #hashmap

[LeetCode] 2938. Separate Black and White Balls

There are n balls on a table, each ball has a color black or white. You are given a 0-indexed binary string s of length n, where 1 and 0 represent black and white balls, respectively. In each step, yo
2024-06-05
#leetcode #java #two pointer #greedy #string

[LeetCode] 2028. Find Missing Observations

You have observations of n + m 6-sided dice rolls with each face numbered from 1 to 6. n of the observations went missing, and you only have the observations of m rolls. Fortunately, you have also cal
2024-05-26
#leetcode #java #array #math #simulation

[LeetCode] 2903. Find Indices With Index and Value Difference I

You are given a 0-indexed integer array nums having length n, an integer indexDifference, and an integer valueDifference. Your task is to find two indices i and j, both in the range [0, n - 1], that s
2024-05-25
#leetcode #java #array #two pointer #two sum #sliding window #sliding window with fixed size

[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
1…7891011…41

Search

Hexo Fluid