![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++练习
文章平均质量分 64
matrix6666
这个作者很懒,什么都没留下…
展开
-
【leetcode】二叉树中序遍历(stack)
94. Binary Tree Inorder Traversalleetcode题目题目描述Given a binary tree, return the inorder traversal of its nodes’ values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3re原创 2018-01-03 14:09:36 · 519 阅读 · 0 评论 -
【leetcode】二叉树先序遍历(stack)
144. Binary Tree Preorder Traversalleetcode题目题目描述Pick OneGiven a binary tree, return the preorder traversal of its nodes’ values. For example: Given binary tree [1,null,2,3], 1 \ 2原创 2018-01-03 13:56:12 · 270 阅读 · 0 评论 -
【leetcode】Unique Paths(动态规划)
62. Unique Pathsleetcode 题目描述A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time.原创 2018-01-03 09:34:45 · 293 阅读 · 0 评论 -
【leetcode】Reverse Integer(考虑溢出问题)
7. Reverse Integerleetcode题目题目描述Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123 Output: 321 Example 2:Input: -123 Output: -321 Example 3:Input: 120 Output: 21Note原创 2017-11-22 11:33:15 · 259 阅读 · 0 评论 -
【leetcode】最长连续序列(unordered_map的使用)
128. Longest Consecutive Sequenceleetcode题目描述题目描述:Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given [100, 4, 200, 1, 3, 2], The lo原创 2017-11-22 09:16:10 · 742 阅读 · 0 评论 -
【leetcode】Two Sum(unordered_map的使用)
1. Two Sumleetcode题目描述题目描述: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 y原创 2017-11-22 10:39:24 · 433 阅读 · 0 评论 -
【leetcode】搜索范围(二分查找升序数组target元素上下界)
34. Search for a Rangeleetcode题目描述题目描述:Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm’s runtime complexity must be原创 2017-11-01 09:46:06 · 784 阅读 · 0 评论 -
【leetcode】寻找两个已排序数组的中位数(类似二分)
4. Median of Two Sorted Arraysleetcode题目描述题目描述:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity shoul原创 2017-10-23 21:57:30 · 801 阅读 · 0 评论 -
【leetcode】查找插入位置(二分)
35. Search Insert Positionleetcode题目描述题目描述: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. Y原创 2017-09-20 10:31:17 · 811 阅读 · 0 评论 -
【leetcode】有重复的旋转排序数组查找(二分)
81. Search in Rotated Sorted Array IIleetcode题目描述题目描述:Follow up for “Search in Rotated Sorted Array”: What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose原创 2017-09-28 13:34:29 · 582 阅读 · 0 评论 -
【leetcode】在旋转排序数组中查找(二分)
33. Search in Rotated Sorted Arrayleetcode题目描述题目描述:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are原创 2017-09-27 14:13:18 · 422 阅读 · 0 评论 -
【leetcode】已排序数组去重
【leetcode】已排序数组去重leetcode题目描述26. Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocat原创 2017-09-11 17:36:02 · 1352 阅读 · 0 评论 -
【leetcode】已排序数组去重 II
80. Remove Duplicates from Sorted Array IIleetcode题目描述题目描述: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 s原创 2017-09-12 21:44:02 · 1101 阅读 · 0 评论 -
【leetcode】二叉树后序遍历(stack)
145. Binary Tree Postorder Traversalleetcode题目题目描述Given a binary tree, return the postorder traversal of its nodes’ values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3原创 2018-01-03 14:41:39 · 354 阅读 · 0 评论