随笔分类 -  LeetCode解题

上一页 1 2 3 4 5 6 下一页
108. Convert Sorted Array to Binary Search Tree 解题记录
摘要:题目描述: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tre 阅读全文
posted @ 2018-02-09 23:56 宵夜在哪 阅读(100) 评论(0) 推荐(0)
107. Binary Tree Level Order Traversal II 解题记录
摘要:题目描述: 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) 阅读全文
posted @ 2018-02-08 20:17 宵夜在哪 阅读(89) 评论(0) 推荐(0)
104. Maximum Depth of Binary Tree 解题记录
摘要:题目描述: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the fart 阅读全文
posted @ 2018-02-08 17:40 宵夜在哪 阅读(92) 评论(0) 推荐(0)
101. Symmetric Tree 解题记录
摘要:题目描述: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is 阅读全文
posted @ 2018-02-07 21:06 宵夜在哪 阅读(106) 评论(0) 推荐(0)
100. Same Tree 解题记录
摘要:题目描述: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally 阅读全文
posted @ 2018-02-07 20:32 宵夜在哪 阅读(109) 评论(0) 推荐(0)
88. Merge Sorted Array 解题记录
摘要:题目描述: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nums1 has enough space (s 阅读全文
posted @ 2018-02-06 16:17 宵夜在哪 阅读(94) 评论(0) 推荐(0)
83. Remove Duplicates from Sorted List 解题记录
摘要:题目描述: 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-> 阅读全文
posted @ 2018-02-06 14:37 宵夜在哪 阅读(87) 评论(0) 推荐(0)
69. Sqrt(x) 解题记录
摘要:题目描述: Implement int sqrt(int x). Compute and return the square root of x. x is guaranteed to be a non-negative integer. 本题让我们写一个类似sqrt()的函数,不过返回值和输入值都 阅读全文
posted @ 2018-02-05 10:26 宵夜在哪 阅读(101) 评论(0) 推荐(0)
70. Climbing Stairs 解题记录
摘要:题目描述: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can 阅读全文
posted @ 2018-02-05 10:12 宵夜在哪 阅读(100) 评论(0) 推荐(0)
67. Add Binary 解题记录
摘要:题目描述: Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 本题给我们两个字符串形式的二进制数,让我们计算相加之后的结果。 解 阅读全文
posted @ 2018-02-04 19:57 宵夜在哪 阅读(80) 评论(0) 推荐(0)
66. Plus One 解题记录
摘要:题目描述: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any 阅读全文
posted @ 2018-02-04 19:25 宵夜在哪 阅读(105) 评论(0) 推荐(0)
58. Length of Last Word 解题记录
摘要:题目描述: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the las 阅读全文
posted @ 2018-02-03 15:20 宵夜在哪 阅读(100) 评论(0) 推荐(0)
53. Maximum Subarray 解题记录
摘要:题目描述: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4 阅读全文
posted @ 2018-02-03 14:46 宵夜在哪 阅读(97) 评论(0) 推荐(0)
38. Count and Say 解题记录
摘要:题目描述: The count-and-say sequence is the sequence of integers with the first five terms as following: 1 is read off as "one 1" or 11.11 is read off as 阅读全文
posted @ 2018-02-02 12:29 宵夜在哪 阅读(119) 评论(0) 推荐(0)
35. Search Insert Position 解题记录
摘要:题目描述: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted 阅读全文
posted @ 2018-02-02 10:58 宵夜在哪 阅读(110) 评论(0) 推荐(0)
28. Implement strStr() 解题记录
摘要:题目描述: Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 比对字符串haystack和needl 阅读全文
posted @ 2018-02-01 14:04 宵夜在哪 阅读(115) 评论(0) 推荐(0)
27. Remove Element 解题记录
摘要:题目描述: Given an array and a value, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array 阅读全文
posted @ 2018-02-01 11:12 宵夜在哪 阅读(89) 评论(0) 推荐(0)
26. Remove Duplicates from Sorted Array 解题记录
摘要:题目描述: Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra sp 阅读全文
posted @ 2018-01-31 16:49 宵夜在哪 阅读(115) 评论(0) 推荐(0)
14. Longest Common Prefix 解题记录
摘要:题目描述: Write a function to find the longest common prefix string amongst an array of strings. 读入一个char**和字符串的数量strSize,返回所有字符串前面相同的字符(char*类型). 解题思路: 将 阅读全文
posted @ 2018-01-31 15:21 宵夜在哪 阅读(112) 评论(0) 推荐(0)
206. Reverse Linked List 解题记录
摘要:题目描述: Reverse a singly linked list. 解题思路: 可用递归的方法对链表进行反转。 代码: 解题收获: 温习了基本的递归思想和链表的使用。但做的时候还是迷茫了很久,说明对链表的使用还是不太熟悉。 阅读全文
posted @ 2017-11-18 22:34 宵夜在哪 阅读(145) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 下一页