随笔分类 - leetcode
摘要:Guess Number Higher or Lower We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I pick
阅读全文
摘要:Convert a Number to Hexadecimal Given an integer num, return a string representing its hexadecimal representation. For negative integers, two’s comple
阅读全文
摘要:Find Mode in Binary Search Tree Given the root of a binary search tree (BST) with duplicates, return all the mode(s) (i.e., the most frequently occurr
阅读全文
摘要:Minimum Absolute Difference in BST Given the root of a Binary Search Tree (BST), return the minimum absolute difference between the values of any two
阅读全文
摘要: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
阅读全文
摘要:Maximum Depth of N-ary Tree Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root
阅读全文
摘要: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 no
阅读全文
摘要:Range Sum Query - Immutable Given an integer array nums, handle multiple queries of the following type: Calculate the sum of the elements of nums betw
阅读全文
摘要:Power of Three Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three, if there exists a
阅读全文
摘要:Power of Four Given an integer n, return true if it is a power of four. Otherwise, return false. An integer n is a power of four, if there exists an i
阅读全文
摘要:Middle of the Linked List Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the
阅读全文
摘要:Uncommon Words from Two Sentences A sentence is a string of single-space separated words where each word consists only of lowercase letters. A word is
阅读全文
摘要:DI String Match A permutation perm of n + 1 integers of all the integers in the range [0, n] can be represented as a string s of length n where: s[i]
阅读全文
摘要:Find Common Characters Given a string array words, return an array of all characters that show up in all strings within the words (including duplicate
阅读全文
摘要:Set Mismatch You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers
阅读全文
摘要:Valid Mountain Array Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if a
阅读全文
摘要:Degree of an Array Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of i
阅读全文
摘要:Distribute Candies Alice has n candies, where the ith candy is of type candyType[i]. Alice noticed that she started to gain weight, so she visited a d
阅读全文
摘要:Longest Harmonious Subsequence We define a harmonious array as an array where the difference between its maximum value and its minimum value is exactl
阅读全文
摘要:Range Addition II You are given an m x n matrix M initialized with all 0's and an array of operations ops, where ops[i] = [ai, bi] means M[x][y] shoul
阅读全文

浙公网安备 33010602011771号