CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 1325. Delete Leaves With a Given Value

Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target, if its parent node becomes a leaf node and has the
2020-12-02
#leetcode #tree #java #postorder #recursion

[LeetCode] 814. Binary Tree Pruning

Given the root of a binary tree, return the same tree where every subtree (of the given tree) not containing a 1 has been removed. A subtree of a node node is node plus every node that is a descendant
2020-12-02
#leetcode #tree #java #postorder

[LeetCode] 1010. Pairs of Songs With Total Durations Divisible by 60

You are given a list of songs where the ith song has a duration of time[i] seconds. Return the number of pairs of songs for which their total duration in seconds is divisible by 60. Formally, we want
2020-11-28
#leetcode #java #array #hashmap #counting sort #two sum #MOD

[LeetCode] 395. Longest Substring with At Least K Repeating Characters

Given a string s and an integer k, return the length of the longest substring of s such that the frequency of each character in this substring is greater than or equal to k. if no such substring exist
2020-11-28
#leetcode #java #hashmap #sliding window #string #divide and conquer

[LeetCode] 1404. Number of Steps to Reduce a Number in Binary Representation to One

Given the binary representation of an integer as a string s, return the number of steps to reduce it to 1 under the following rules:If the current number is even, you have to divide it by 2.If the cur
2020-11-23
#leetcode #java #string #bit manipulation

[LeetCode] 1582. Special Positions in a Binary Matrix

Given an m x n binary matrix mat, return the number of special positions in mat. A position (i, j) is called special if mat[i][j] == 1 and all other elements in row i and column j are 0 (row
2020-11-14
#leetcode #java #array #hashmap

[LeetCode] 1283. Find the Smallest Divisor Given a Threshold

Given an array of integers nums and an integer threshold, we will choose a positive integer divisor, divide all the array by it, and sum the division’s result. Find the smallest divisor such that the
2020-11-07
#leetcode #java #array #binary search

[LeetCode] 135. Candy

There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements: Each child must have at least one cand
2020-11-03
#leetcode #java #array #greedy

[LeetCode] 1219. Path with Maximum Gold

In a gold mine grid of size m * n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty. Return the maximum amount of gold you can collect under the con
2020-10-30
#leetcode #dfs #java #backtracking

[LeetCode] 720. Longest Word in Dictionary

Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than one possible a
2020-10-29
#leetcode #java #hashmap #sort #string #trie
1…2627282930…48

Search

Hexo Fluid