CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 3024. Type of Triangle

You are given a 0-indexed integer array nums of size 3 which can form the sides of a triangle. A triangle is called equilateral if it has all sides of equal length.A triangle is called isosceles if it
2025-05-18
#leetcode #java #array #sort #math

[LeetCode] 2874. Maximum Value of an Ordered Triplet II

You are given a 0-indexed integer array nums. Return the maximum value over all triplets of indices (i, j, k) such that i < j < k. If all such triplets have a negative value, return 0. The value
2025-04-01
#leetcode #java #array #hashmap #two sum

[LeetCode] 2780. Minimum Index of a Valid Split

An element x of an integer array arr of length m is dominant if more than half the elements of arr have a value of x. You are given a 0-indexed integer array nums of length n with one dominant element
2025-03-27
#leetcode #java #array #hashmap

[LeetCode] 2033. Minimum Operations to Make a Uni-Value Grid

You are given a 2D integer grid of size m x n and an integer x. In one operation, you can add x to or subtract x from any element in the grid. A uni-value grid is a grid where all the elements of it a
2025-03-26
#leetcode #java #array #sort #math #matrix

[LeetCode] 2712. Minimum Cost to Make All Characters Equal

You are given a 0-indexed binary string s of length n on which you can apply two types of operations: Choose an index i and invert all characters from index 0 to index i (both inclusive), with a cost
2025-03-26
#leetcode #java #dynamic programming #greedy #string

[LeetCode] 3191. Minimum Operations to Make Binary Array Elements Equal to One I

You are given a binary array nums. You can do the following operation on the array any number of times (possibly zero): Choose any 3 consecutive elements from the array and flip all of them.Flipping a
2025-03-19
#leetcode #java #array #greedy #bit manipulation

[LeetCode] 2610. Convert an Array Into a 2D Array With Conditions

You are given an integer array nums. You need to create a 2D array from nums satisfying the following conditions: The 2D array should contain only the elements of the array nums.Each row in the 2D arr
2025-03-18
#leetcode #java #array #hashmap

[LeetCode] 2401. Longest Nice Subarray

You are given an array nums consisting of positive integers. We call a subarray of nums nice if the bitwise AND of every pair of elements that are in different positions in the subarray is equal to 0.
2025-03-18
#leetcode #java #array #sliding window #bit manipulation

[LeetCode] 2226. Maximum Candies Allocated to K Children

You are given a 0-indexed integer array candies. Each element in the array denotes a pile of candies of size candies[i]. You can divide each pile into any number of sub piles, but you cannot merge two
2025-03-13
#leetcode #java #array #binary search #binary search on answer

[LeetCode] 3101. Count Alternating Subarrays

You are given a binary array nums. We call a subarray alternating if no two adjacent elements in the subarray have the same value. Return the number of alternating subarrays in nums. Example 1:Input:
2025-03-10
#leetcode #java #array #math
1234…44

Search

Hexo Fluid