CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 1457. Pseudo-Palindromic Paths in a Binary Tree

Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be pseudo-palindromic if at least one permutation of the node values in the path is a palindrome. Ret
2020-12-30
#leetcode #tree #dfs #java #preorder #backtracking

[LeetCode] 1358. Number of Substrings Containing All Three Characters

Given a string s consisting only of characters a, b and c. Return the number of substrings containing at least one occurrence of all these characters a, b and c. Example 1:Input: s = “abcabc”Outp
2020-12-24
#leetcode #java #hashmap #two pointer #sliding window #string

[LeetCode] 1020. Number of Enclaves

You are given an m x n binary matrix grid, where 0 represents a sea cell and 1 represents a land cell. A move consists of walking from one land cell to another adjacent (4-directionally) land cell or
2020-12-22
#leetcode #bfs #dfs #java #flood fill

[LeetCode] 921. Minimum Add to Make Parentheses Valid

A parentheses string is valid if and only if: It is the empty string, It can be written as AB (A concatenated with B), where A and B are valid strings, or It can be written as (A), where A is a valid
2020-12-18
#leetcode #java #greedy #stack

[LeetCode] 1669. Merge In Between Linked Lists

You are given two linked lists: list1 and list2 of sizes n and m respectively. Remove list1’s nodes from the ath node to the bth node, and put list2 in their place. The blue edges and nodes in the fol
2020-12-15
#leetcode #java #linked list

[LeetCode] 1609. Even Odd Tree

A binary tree is named Even-Odd if it meets the following conditions:The root of the binary tree is at level index 0, its children are at level index 1, their children are at level index 2, etc.For ev
2020-12-10
#leetcode #tree #bfs #java

[LeetCode] 897. Increasing Order Search Tree

Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child. Exa
2020-12-04
#leetcode #tree #java #linked list #inorder

[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
1…2324252627…44

Search

Hexo Fluid