01 2023 档案
摘要: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
阅读全文
摘要:网络上查到的使用 netsh 命令,没有用 使用下面的命令开启热点 @echo off powershell.exe -encodedCommand WwBXAGkAbgBkAG8AdwBzAC4AUwB5AHMAdABlAG0ALgBVAHMAZQByAFAAcgBvAGYAaQBsAGUALgB
阅读全文
摘要:find . -name \*.log -print0 | xargs -0 grep -n -H "Something" 参考 Filenames and linenumbers for the matches of cat and grep
阅读全文
摘要: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
阅读全文
摘要:Can Place Flowers You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent p
阅读全文
摘要:LongestContinuous Increasing Subsequence Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence
阅读全文
摘要:Baseball Game You are keeping the scores for a baseball game with strange rules. At the beginning of the game, you start with an empty record. You are
阅读全文
摘要:Excel Sheet Column Number Given a string columnTitle that represents the column title as appears in an Excel sheet, return its corresponding column nu
阅读全文
摘要:Implement Stack using Queues Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions
阅读全文
摘要:Palindrome Linked List Given the head of a singly linked list, return true if it is a palindrome or false otherwise. Example 1: Input: head = [1,2,2,1
阅读全文
摘要:Max Consecutive Ones Given a binary array nums, return the maximum number of consecutive 1's in the array. Example 1: Input: nums = [1,1,0,1,1,1] Outp
阅读全文
摘要:Number of Segments in a String Given a string s, return the number of segments in the string. A segment is defined to be a contiguous sequence of non-
阅读全文
摘要:Next Greater Element I The next greater element of some element x in an array is the first greater element that is to the right of x in the same array
阅读全文
摘要:Longest Uncommon Subsequence I Given two strings a and b, return the length of the longest uncommon subsequence between a and b. If the longest uncomm
阅读全文
摘要:Student Attendance Record I You are given a string s representing an attendance record for a student where each character signifies whether the studen
阅读全文
摘要:Longest Palindrome Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built wi
阅读全文
摘要:Reverse Vowels of a String Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and
阅读全文
摘要:Maximum Average Subarray I You are given an integer array nums consisting of n elements, and an integer k. Find a contiguous subarray whose length is
阅读全文
摘要:Binary Tree Tilt Given the root of a binary tree, return the sum of every tree node's tilt. The tilt of a tree node is the absolute difference between
阅读全文
摘要:Intersection of Two Arrays Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique
阅读全文
摘要:Intersection of Two Arrays II Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear
阅读全文
摘要:Valid Perfect Square Given a positive integer num, return true if num is a perfect square or false otherwise. A perfect square is an integer that is t
阅读全文
摘要:First Unique Character in a String Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -
阅读全文
摘要:Third Maximum Number Given an integer array nums, return the third distinct maximum number in this array. If the third maximum does not exist, return
阅读全文
摘要:Reverse Linked List Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: Input: head = [1,2,3,4,5] Outpu
阅读全文
摘要:Excel Sheet Column Title Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet. For example: A -> 1 B -
阅读全文
摘要:Binary Tree Postorder Traversal Given the root of a binary tree, return the postorder traversal of its nodes' values. Example 1: Input: root = [1,null
阅读全文
摘要:Binary Tree Preorder Traversal Given the root of a binary tree, return the preorder traversal of its nodes' values. Example 1: Input: root = [1,null,2
阅读全文
摘要:Best Time to Buy and Sell Stock You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your
阅读全文
摘要:Arranging Coins You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i
阅读全文
摘要:Repeated Substring Pattern Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring
阅读全文
摘要:Construct the Rectangle A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by n
阅读全文
摘要:Reverse Words in a String III Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and i
阅读全文
摘要:Island Perimeter You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water. Grid cells
阅读全文
摘要:win10 系统下的 Tim 个人文件夹默认保存在“我的文档”,虽然有个自定义选项,但是重启后会自动还原到“我的文档”。 可以用 windows 提供的文件夹映射来解决这个问题 MKLINK [[/D] | [/H] | [/J]] Link Target 例如,我们想把 Tim 文件夹放到 D 盘
阅读全文