![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
hancaicai123
这个作者很懒,什么都没留下…
展开
-
两个数组并归
题目: Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume that A has enough space to hold additional elements from B. The number of elements initialized原创 2017-08-17 15:32:04 · 300 阅读 · 0 评论 -
leetcode有序数组转换成BST
1 .convert-sorted-array-to-binary-search-tree 题目要求: Given an array where elements are sorted in ascending order, convert it to a height balanced BST 解题思路: 分冶递归,每次找序列的中间值 有序数组首先考虑二分法/** * Definiti原创 2017-08-14 11:57:26 · 584 阅读 · 0 评论 -
leetcode 股票收益问题
1.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 (ie, buy原创 2017-08-14 11:49:31 · 627 阅读 · 0 评论 -
leetcode编程中数组题目
1、题目要求:longest-consecutive-sequence(最长的连续序列) 注意:集合的快速失败机制(不能一边遍历一边删除) /*Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given[100, 4,原创 2017-08-13 22:34:32 · 202 阅读 · 0 评论 -
矩阵中寻找目标
题目: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right. The first integer of each r原创 2017-08-17 16:02:48 · 187 阅读 · 0 评论 -
移除重复数字
问题: Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice? For example, Given sorted array A =[1,1,1,2,2,3], Your function should return length =5, and A is now[1,1,2,2,3原创 2017-08-17 16:17:06 · 297 阅读 · 0 评论 -
构造矩阵
题目1: 说明:和剑指offer中的顺时针打印矩阵很类似(稍微简单一点) Given an integer n, generate a square matrix filled with elements from 1 to n 2 in spiral order. For example, Given n =3, You should return the following matri原创 2017-08-17 17:51:53 · 424 阅读 · 0 评论