CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2566. Maximum Difference by Remapping a Digit

You are given an integer num. You know that Bob will sneakily remap one of the 10 possible digits (0 to 9) to another digit. Return the difference between the maximum and minimum values Bob can make b
2025-06-14
#leetcode #java #greedy #string

[LeetCode] 386. Lexicographical Numbers

Given an integer n, return all the numbers in the range [1, n] sorted in lexicographical order. You must write an algorithm that runs in O(n) time and uses O(1) extra space. Example 1:Input: n =
2025-06-09
#leetcode #java #dfs #trie

[LeetCode] 2434. Using a Robot to Print the Lexicographically Smallest String

You are given a string s and a robot that currently holds an empty string t. Apply one of the following operations until s and t are both empty: Remove the first character of a string s and give it to
2025-06-05
#leetcode #java #greedy #string #stack

[LeetCode] 3403. Find the Lexicographically Largest String From the Box I

You are given a string word, and an integer numFriends. Alice is organizing a game for her numFriends friends. There are multiple rounds in the game, where in each round: word is split into numFriends
2025-06-03
#leetcode #java #string

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

[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 #array #java #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 #array #java #greedy #bit manipulation
12345…48

Search

Hexo Fluid