
LeetCode之Arrays
文章平均质量分 50
小楼闻夜雨
转:生活最主要的还是感受,坚持是一种刻意的练习,不断寻找缺点突破缺点的过程,而不是重复做某件事情。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Find All Numbers Disappeared in an Array(哈希表)
题目描述 Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this原创 2017-07-04 12:00:22 · 187 阅读 · 0 评论 -
Third Maximum Number
题目描述 Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). 思路 找到第三大的数,用三个数存储前原创 2017-07-03 22:39:27 · 172 阅读 · 0 评论 -
Missing Number
题目描述 Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. 思路 注意这里并没有说给你的数组一定是有序的,只原创 2017-06-30 10:40:35 · 218 阅读 · 0 评论 -
Contains Duplicate
题目 Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every elem原创 2017-06-29 20:23:27 · 241 阅读 · 0 评论 -
Majority Element
原题描述 Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majorit原创 2017-06-29 16:11:22 · 190 阅读 · 0 评论