随笔分类 - leetcode
摘要:Minimum Distancd Between Nodes Given the root of a Binary Search Tree (BST), return the minimum difference between the values of any two different nod
阅读全文
摘要:Goat Latin You are given a string sentence that consist of words separated by spaces. Each word consists of lowercase and uppercase letters only. We w
阅读全文
摘要:Smallest Range I You are given an integer array nums and an integer k. In one operation, you can choose any index i where 0 <= i < nums.length and cha
阅读全文
摘要:Shortest Distance to a Character Given a string s and a character c that occurs in s, return an array of integers answer where answer.length == s.leng
阅读全文
摘要:Last Stone Weight You are given an array of integers stones where stones[i] is the weight of the ith stone. We are playing a game with the stones. On
阅读全文
摘要:Height Checker A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing
阅读全文
摘要:Maximum 69 Number You are given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can get by changing at most on
阅读全文
摘要:Check if N and Its Double Exist Given an array arr of integers, check if there exist two indices i and j such that : i != j 0 <= i, j < arr.length arr
阅读全文
摘要:How Many Numbers Are Smaller Than the Current Number Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it
阅读全文
摘要:Generate a String With Characters That Have Odd Counts Given an integer n, return a string with n characters such that each character in such string o
阅读全文
摘要:N-ary Tree Preorder Traversal Given the root of an n-ary tree, return the preorder traversal of its nodes' values. Nary-Tree input serialization is re
阅读全文
摘要:N-ary Tree postorder Traversal Given the root of an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is
阅读全文
摘要:Construct String from Binary Tree Given the root of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with t
阅读全文
摘要:Merge Two Binary Trees You are given two binary trees root1 and root2. Imagine that when you put one of them to cover the other, some nodes of the two
阅读全文
摘要:Average of Levels in Binary Tree Given the root of a binary tree, return the average value of the nodes on each level in the form of an array. Answers
阅读全文
摘要:Implement Queue using Stacks Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions
阅读全文
摘要:Two Sum IV - Input is a BST Given the root of a binary search tree and an integer k, return true if there exist two elements in the BST such that thei
阅读全文
摘要:Image Smoother An image smoother is a filter of the size 3 x 3 that can be applied to each cell of an image by rounding down the average of the cell a
阅读全文
摘要:Second Minimum Node In a Binary Tree Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tr
阅读全文
摘要:Search in a Binary Search Tree You are given the root of a binary search tree (BST) and an integer val. Find the node in the BST that the node's value
阅读全文

浙公网安备 33010602011771号