CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 222. Count Complete Tree Nodes

Given the root of a complete binary tree, return the number of the nodes in the tree. According to Wikipedia, every level, except possibly the last, is completely filled in a complete binary tree, and
2020-03-22
#leetcode #java #tree #binary search #divide and conquer

[LeetCode] 230. Kth Smallest Element in a BST

Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree. Example 1:Input: root = [3,1,4,null,2], k = 1O
2020-03-20
#leetcode #java #javascript #tree #inorder #BST

[LeetCode] 238. Product of Array Except Self

Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. The product of any prefix or suffix of nums is guaranteed to
2020-03-20
#leetcode #array #java #javascript #prefix sum

[LeetCode] 409. Longest Palindrome

Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. Letters are case sensitive, for example, “Aa” is no
2020-03-19
#leetcode #hashmap #java #javascript #string #palindrome

[LeetCode] 543. Diameter of Binary Tree

Given the root of a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may no
2020-03-18
#leetcode #java #tree #postorder

[LeetCode] 114. Flatten Binary Tree to Linked List

Given the root of a binary tree, flatten the tree into a “linked list”: The “linked list” should use the same TreeNode class where the right child pointer points to the next node in the list and the
2020-03-17
#leetcode #java #javascript #linked list #stack

[LeetCode] 739. Daily Temperatures

Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperatu
2020-03-15
#leetcode #array #java #javascript #stack #monotonic stack

[LeetCode] 6. Zigzag Conversion

The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H NA P L S I I GY
2020-03-14
#leetcode #java #string

[LeetCode] 692. Top K Frequent Words

Given an array of strings words and an integer k, return the k most frequent strings. Return the answer sorted by the frequency from highest to lowest. Sort the words with the same frequency by their
2020-03-13
#leetcode #hashmap #java #sort #heap

[LeetCode] 572. Subtree of Another Tree

Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise. A subtree of a binary tree tree
2020-03-12
#leetcode #java #javascript #tree #dfs #recursion
1…3637383940…46

Search

Hexo Fluid