CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2053. Kth Distinct String in an Array

A distinct string is a string that is present only once in an array. Given an array of strings arr, and an integer k, return the kth distinct string present in arr. If there are fewer than k distinct
2024-08-04
#leetcode #array #hashmap #java #string

[LeetCode] 2134. Minimum Swaps to Group All 1s Together II

A swap is defined as taking two distinct positions in an array and swapping the values in them. A circular array is defined as an array where we consider the first element and the last element to be a
2024-08-03
#leetcode #array #java #prefix sum #sliding window #sliding window with fixed size

[LeetCode] 1380. Lucky Numbers in a Matrix

Given an m x n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that it is the minimum element in its row and maximum in
2024-07-18
#leetcode #array #java #matrix

[LeetCode] 3096. Minimum Levels to Gain More Points

You are given a binary array possible of length n. Alice and Bob are playing a game that consists of n levels. Some of the levels in the game are impossible to clear while others can always be cleared
2024-07-18
#leetcode #array #java #prefix sum

[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 #array #hashmap #java #tree

[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 #two pointer #java #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 #array #java #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 #array #two pointer #java #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 #array #hashmap #java #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 #array #java #dfs #backtracking #bit manipulation
1…89101112…46

Search

Hexo Fluid