CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2192. All Ancestors of a Node in a Directed Acyclic Graph

You are given a positive integer n representing the number of nodes of a Directed Acyclic Graph (DAG). The nodes are numbered from 0 to n - 1 (inclusive). You are also given a 2D integer array edges,
2024-04-06
#leetcode #bfs #dfs #java #graph #topological sort

[LeetCode] 2962. Count Subarrays Where Max Element Appears at Least K Times

You are given an integer array nums and a positive integer k. Return the number of subarrays where the maximum element of nums appears at least k times in that subarray. A subarray is a contiguous seq
2024-03-29
#leetcode #java #array #sliding window

[LeetCode] 2789. Largest Element in an Array after Merge Operations

You are given a 0-indexed array nums consisting of positive integers. You can do the following operation on the array any number of times:Choose an integer i such that 0 <= i < nums.length
2024-03-14
#leetcode #java #array #greedy

[LeetCode] 2129. Capitalize the Title

You are given a string title consisting of one or more words separated by a single space, where each word consists of English letters. Capitalize the string by changing the capitalization of each word
2024-03-10
#leetcode #java #string

[LeetCode] 2575. Find the Divisibility Array of a String

You are given a 0-indexed string word of length n consisting of digits, and a positive integer m. The divisibility array div of word is an integer array of length n such that: div[i] = 1 if the n
2024-03-06
#leetcode #java #array #MOD #math #string

[LeetCode] 1750. Minimum Length of String After Deleting Similar Ends

Given a string s consisting only of characters ‘a’, ‘b’, and ‘c’. You are asked to apply the following algorithm on the string any number of times: Pick a non-empty prefix from the string s where all
2024-03-05
#leetcode #java #two pointer #string

[LeetCode] 2368. Reachable Nodes With Restrictions

There is an undirected tree with n nodes labeled from 0 to n - 1 and n - 1 edges. You are given a 2D integer array edges of length n - 1 where edges[i] = [ai, bi] indicates that there is an edge
2024-03-01
#leetcode #bfs #dfs #java #array #hashmap #graph #union find

[LeetCode] 2864. Maximum Odd Binary Number

You are given a binary string s that contains at least one ‘1’. You have to rearrange the bits in such a way that the resulting binary number is the maximum odd binary number that can be created from
2024-02-29
#leetcode #java #greedy #math #string

[LeetCode] 2583. Kth Largest Sum in a Binary Tree

You are given the root of a binary tree and a positive integer k. The level sum in the tree is the sum of the values of the nodes that are on the same level. Return the kth largest level sum in the tr
2024-02-27
#leetcode #tree #bfs #java #sort

[LeetCode] 2476. Closest Nodes Queries in a Binary Search Tree

You are given the root of a binary search tree and an array queries of size n consisting of positive integers. Find a 2D array answer of size n where answer[i] = [mini, maxi]:mini is the largest
2024-02-25
#leetcode #tree #java #array #binary search #treemap #bst
1…1011121314…47

Search

Hexo Fluid