随笔分类 - LeetCode
摘要: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 picked. Every time you guess wron
        阅读全文
                
摘要:Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: Example 1: Example 2:
        阅读全文
                
摘要:Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A. We want to find 
        阅读全文
                
摘要:Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --
        阅读全文
                
摘要:Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front
        阅读全文
                
摘要:You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups b
        阅读全文
                
摘要:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example:
        阅读全文
                
摘要:Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3,
        阅读全文
                
摘要:In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as
        阅读全文
                
摘要:Reverse a singly linked list. 反转单链表 C++(9ms): 迭代
        阅读全文
                
摘要:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Note: There are at
        阅读全文
                
摘要:Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list t
        阅读全文
                
摘要:You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1'
        阅读全文
                
摘要:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might
        阅读全文
                
摘要:Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subt
        阅读全文
                
摘要:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For 
        阅读全文
                
摘要:Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept
        阅读全文
                
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l
        阅读全文
                
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F
        阅读全文
                
摘要:Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longestpath betwee
        阅读全文
                
 
                    
                
 浙公网安备 33010602011771号
浙公网安备 33010602011771号