随笔分类 -  LeetCode

上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
摘要: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 阅读全文
posted @ 2018-01-13 13:14 __Meng 阅读(142) 评论(0) 推荐(0)
摘要: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: 阅读全文
posted @ 2018-01-12 11:14 __Meng 阅读(146) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-01-10 15:35 __Meng 阅读(155) 评论(0) 推荐(0)
摘要: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 -- 阅读全文
posted @ 2018-01-09 10:43 __Meng 阅读(128) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-01-08 10:00 __Meng 阅读(176) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-01-05 10:30 __Meng 阅读(238) 评论(0) 推荐(0)
摘要: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: 阅读全文
posted @ 2018-01-02 10:51 __Meng 阅读(153) 评论(0) 推荐(0)
摘要: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, 阅读全文
posted @ 2017-12-31 13:37 __Meng 阅读(142) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-30 13:27 __Meng 阅读(159) 评论(0) 推荐(0)
摘要:Reverse a singly linked list. 反转单链表 C++(9ms): 迭代 阅读全文
posted @ 2017-12-26 11:09 __Meng 阅读(126) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-25 10:15 __Meng 阅读(198) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-24 14:59 __Meng 阅读(177) 评论(0) 推荐(0)
摘要: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' 阅读全文
posted @ 2017-12-23 16:09 __Meng 阅读(311) 评论(0) 推荐(1)
摘要: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 阅读全文
posted @ 2017-12-21 10:26 __Meng 阅读(139) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-20 11:03 __Meng 阅读(142) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-19 09:58 __Meng 阅读(143) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-18 09:59 __Meng 阅读(133) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-17 14:09 __Meng 阅读(176) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-16 18:43 __Meng 阅读(142) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-15 10:10 __Meng 阅读(139) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页