
LeetCode
文章平均质量分 64
yesr2014
大连理工大学软件工程专业本科生
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
94. Binary Tree Inorder Traversal
【思路分析】 二叉树中序遍历的实现通常有两种方法:递归和迭代。 递归思路很简单,所以这里我只说迭代版本的思路。 根据中序遍历的顺序,对于任一结点,优先访问其左孩子,而左孩子结点又可以看做一根结点,然后继续访问其左孩子结点,直到遇到左孩子结点为空的结点才进行访问,然后按照相同的规则访问其 右子树。因此处理过程如下: 对任一结点p1.若其左孩子不为空,则将p入栈并将p的左孩子置为当前的p,然后...原创 2020-05-01 03:01:20 · 353 阅读 · 0 评论 -
238. Product of Array Except Self
Product of Array Except Self 【题目】 Given an arraynumsofnintegers wheren> 1, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i]. Ex...原创 2019-04-02 17:21:11 · 429 阅读 · 0 评论 -
26. Remove Duplicates from Sorted Array
Remove Duplicates from Sorted Array 【题目】 Given a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length. Do not allocate extra space for...原创 2019-03-15 20:29:31 · 266 阅读 · 0 评论 -
15. Three Sum
Three Sum 【题目】 Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. (给定一个包含 n 个整数的数组 num...原创 2018-11-20 00:56:40 · 284 阅读 · 0 评论 -
167. Two Sum II - Input array is sorted(双向指针)
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 function twoSum...原创 2018-11-08 20:01:43 · 187 阅读 · 0 评论 -
1. Two Sum(HashMap储存数组的值和索引)
Two Sum 【题目】 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may no...原创 2018-11-08 19:46:19 · 368 阅读 · 0 评论 -
35. Search Insert Position(二分法)
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 in order. You may assume...原创 2018-11-07 23:10:33 · 189 阅读 · 0 评论 -
7. Reverse Integer(注意越界问题)
Reverse Integer 【题目】 Given a 32-bit signed integer, reverse digits of an integer. (翻译:给定一个 32 位有符号整数,将整数中的数字进行反转。) Example: Input: 123 Output: 321 Input: -123 Output: -321 Input: 120 Output: 2...原创 2018-11-07 15:23:17 · 392 阅读 · 0 评论 -
189. Rotate Array(三步旋转法)
Rotate Array 【题目】 Given an array, rotate the array to the right by k steps, where k is non-negative. (翻译:给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。) Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: ...原创 2018-11-04 21:15:12 · 318 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters(HashSet + 双指针)
Longest Substring Without Repeating Characters 【题目】 Given a string, find the length of the longest substring without repeating characters. (给定一个字符串,找字符中的最大非重复子串) Example 1: Input: "abcabcbb" Out...原创 2018-11-09 15:22:47 · 222 阅读 · 0 评论 -
121. Best Time to Buy and Sell Stock
Best Time to Buy and Sell Stock 【题目】 Say you have an array for which the i th element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (i.e., b...原创 2018-11-09 14:43:13 · 191 阅读 · 0 评论 -
119. Pascal's Triangle II(杨辉三角简单变形)
Pascal's Triangle II 【题目】 Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's triangle. Note that the row index starts from 0. (翻译:给定一个非负索引 k,其中 k ≤ 33,返回杨辉三角的第 k 行...原创 2018-11-04 00:40:03 · 323 阅读 · 0 评论 -
118. Pascal's Triangle(暴力求解法)
Pascal's Triangle 【题目】 Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. (翻译:给定一个非负整数 numRows,生成杨辉三角的前 numRows 行。) In Pascal's triangle, each number is the s...原创 2018-11-04 00:26:18 · 230 阅读 · 0 评论 -
53. Maximum Subarray (Kadane算法 / 动态规划 / 分治法)
Maximum Subarray 【题目】 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5...原创 2018-11-02 22:11:27 · 570 阅读 · 0 评论