CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2807. Insert Greatest Common Divisors in Linked List

Given the head of a linked list head, in which each node contains an integer value. Between every pair of adjacent nodes, insert a new node with a value equal to the greatest common divisor of them. R
2024-01-05
#leetcode #java #math #gcd #linked list

[LeetCode] 1578. Minimum Time to Make Rope Colorful

Alice has n balloons arranged on a rope. You are given a 0-indexed string colors where colors[i] is the color of the ith balloon. Alice wants the rope to be colorful. She does not want two consecutive
2023-12-27
#leetcode #java #array #greedy #string

[LeetCode] 2660. Determine the Winner of a Bowling Game

You are given two 0-indexed integer arrays player1 and player2, that represent the number of pins that player 1 and player 2 hit in a bowling game, respectively. The bowling game consists of n turns,
2023-12-26
#leetcode #java #array #simulation

[LeetCode] 1496. Path Crossing

Given a string path, where path[i] = ‘N’, ‘S’, ‘E’ or ‘W’, each representing moving one unit north, south, east, or west, respectively. You start at the origin (0, 0) on a 2D plane and walk on th
2023-12-23
#leetcode #java #hashmap #string

[LeetCode] 2415. Reverse Odd Levels of Binary Tree

Given the root of a perfect binary tree, reverse the node values at each odd level of the tree. For example, suppose the node values at level 3 are [2,1,3,4,7,11,29,18], then it should become [18,29,1
2023-12-16
#leetcode #tree #bfs #dfs #java #preorder

[LeetCode] 2482. Difference Between Ones and Zeros in Row and Column

You are given a 0-indexed m x n binary matrix grid. A 0-indexed m x n difference matrix diff is created with the following procedure:Let the number of ones in the ith row be onesRowi.Let the number of
2023-12-15
#leetcode #java #array #matrix #simulation

[LeetCode] 2697. Lexicographically Smallest Palindrome

You are given a string s consisting of lowercase English letters, and you are allowed to perform operations on it. In one operation, you can replace a character in s with another lowercase English let
2023-12-13
#leetcode #java #two pointer #string #palindrome

[LeetCode] 1903. Largest Odd Number in String

You are given a string num, representing a large integer. Return the largest-valued odd integer (as a string) that is a non-empty substring of num, or an empty string “” if no odd integer exists. A su
2023-12-07
#leetcode #java #greedy #math #string

[LeetCode] 1716. Calculate Money in Leetcode Bank

Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more
2023-12-06
#leetcode #java #math

[LeetCode] 1688. Count of Matches in Tournament

You are given an integer n, the number of teams in a tournament that has strange rules:If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches ar
2023-12-05
#leetcode #java #math #simulation
1…1213141516…47

Search

Hexo Fluid