随笔分类 -  LeetCode解题

上一页 1 2 3 4 5 6 下一页
18. 4Sum 解题记录
摘要:题目描述: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the arra 阅读全文
posted @ 2018-02-24 19:43 宵夜在哪 阅读(85) 评论(0) 推荐(0)
16. 3Sum Closest 解题记录
摘要:题目描述: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three int 阅读全文
posted @ 2018-02-24 15:10 宵夜在哪 阅读(96) 评论(0) 推荐(0)
15. 3Sum 解题记录
摘要:题目描述: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the s 阅读全文
posted @ 2018-02-23 22:56 宵夜在哪 阅读(104) 评论(0) 推荐(0)
12. Integer to Roman 解题记录
摘要:题目描述: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 解题思路: 观察罗马数字可以发现个十百千位上的数字是可以分开考虑的。 而 阅读全文
posted @ 2018-02-23 21:53 宵夜在哪 阅读(107) 评论(0) 推荐(0)
11. Container With Most Water 解题记录
摘要:题目描述: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two 阅读全文
posted @ 2018-02-22 21:27 宵夜在哪 阅读(101) 评论(0) 推荐(0)
6. ZigZag Conversion 解题记录
摘要:题目描述: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed 阅读全文
posted @ 2018-02-22 20:55 宵夜在哪 阅读(101) 评论(0) 推荐(0)
5. Longest Palindromic Substring 解题记录
摘要:题目描述: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: 本题要我们找的是字符 阅读全文
posted @ 2018-02-17 11:36 宵夜在哪 阅读(85) 评论(0) 推荐(0)
3. Longest Substring Without Repeating Characters 解题记录
摘要:题目描述: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which th 阅读全文
posted @ 2018-02-16 17:42 宵夜在哪 阅读(97) 评论(0) 推荐(0)
2. Add Two Numbers 解题记录
摘要:题目描述: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes 阅读全文
posted @ 2018-02-15 16:03 宵夜在哪 阅读(120) 评论(0) 推荐(0)
168. Excel Sheet Column Title 解题记录
摘要:题目描述: Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 本题要我们将阿拉伯数字转化为Excel工作簿中列的标题。 解题思路: 本题相 阅读全文
posted @ 2018-02-15 14:45 宵夜在哪 阅读(113) 评论(0) 推荐(0)
167. Two Sum II - Input array is sorted 解题记录
摘要:题目描述: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The fu 阅读全文
posted @ 2018-02-15 01:53 宵夜在哪 阅读(99) 评论(0) 推荐(0)
160. Intersection of Two Linked Lists 解题记录
摘要:题目描述: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin 阅读全文
posted @ 2018-02-15 01:30 宵夜在哪 阅读(83) 评论(0) 推荐(0)
136. Single Number 解题记录
摘要:题目描述: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime 阅读全文
posted @ 2018-02-14 01:08 宵夜在哪 阅读(96) 评论(0) 推荐(0)
122. Best Time to Buy and Sell Stock II 解题记录
摘要:题目描述: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may 阅读全文
posted @ 2018-02-12 15:15 宵夜在哪 阅读(101) 评论(0) 推荐(0)
121. Best Time to Buy and Sell Stock 解题记录
摘要:题目描述: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one trans 阅读全文
posted @ 2018-02-12 14:08 宵夜在哪 阅读(109) 评论(0) 推荐(0)
119. Pascal's Triangle II 解题记录
摘要:题目描述: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorit 阅读全文
posted @ 2018-02-11 22:22 宵夜在哪 阅读(77) 评论(0) 推荐(0)
118. Pascal's Triangle 解题记录
摘要:题目描述: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return 本题要我们输入一个整数(行数),返回二维数组形式的杨辉三角(帕斯卡三角)。 解题思 阅读全文
posted @ 2018-02-11 21:48 宵夜在哪 阅读(108) 评论(0) 推荐(0)
112. Path Sum 解题记录
摘要:题目描述: 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 阅读全文
posted @ 2018-02-10 12:51 宵夜在哪 阅读(111) 评论(0) 推荐(0)
111. Minimum Depth of Binary Tree 解题记录
摘要:题目描述: 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 nea 阅读全文
posted @ 2018-02-10 11:50 宵夜在哪 阅读(76) 评论(0) 推荐(0)
110. Balanced Binary Tree 解题记录
摘要:题目描述: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: Example 1: Given the fol 阅读全文
posted @ 2018-02-10 00:42 宵夜在哪 阅读(96) 评论(0) 推荐(0)

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