数组
Ber03
:)
展开
-
[LeetCode] 217. Contains Duplicate
原题链接: https://leetcode.com/problems/contains-duplicate/ 1. 题目介绍 给出一个一维数组,数组中的元素全都是整数,判断数组中是否有元素重复。 如果有元素重复了,返回 true,如果没有元素重复,那就返回 false。 Example 1: Input: [1,2,3,1] Output: true Example 2: Input: [1,...原创 2019-03-20 00:00:27 · 117 阅读 · 0 评论 -
[LeetCode] 896. Monotonic Array
class Solution { public boolean isMonotonic(int[] A) { int length = A.length; if (length == 0) { return false; } int flag = (A[length-1] > A[0] ? 1 : 2 ); if (flag == 1...原创 2019-05-09 13:58:54 · 119 阅读 · 0 评论 -
[LeetCode] 66. Plus One
原题链接:https://leetcode.com/problems/plus-one/ 1. 题目介绍 Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significan...原创 2019-05-06 15:13:00 · 111 阅读 · 0 评论 -
[LeetCode] 169. Majority Element
原题链接:https://leetcode.com/problems/majority-element/ 1. 题目介绍 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 assu...原创 2019-04-30 22:14:13 · 108 阅读 · 0 评论 -
[LeetCode] 88. Merge Sorted Array
原题链接: https://leetcode.com/problems/merge-sorted-array/ 1. 题目介绍 Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in...原创 2019-04-27 00:19:35 · 77 阅读 · 0 评论 -
[LeetCode] 31. Next Permutation
原题链接: https://leetcode.com/problems/next-permutation/ 1. 题目介绍 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement i...原创 2019-03-27 22:15:08 · 370 阅读 · 0 评论 -
[LeetCode] 189. Rotate Array
原题链接: https://leetcode.com/problems/rotate-array/原创 2019-03-19 12:15:08 · 100 阅读 · 0 评论 -
[LeetCode] 27. Remove Element
原题链接:https://leetcode.com/problems/remove-element/ 1. 题目介绍 Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for a...原创 2019-03-25 23:22:02 · 87 阅读 · 0 评论 -
[LeetCode] 26. Remove Duplicates from Sorted Array
原题链接: https://leetcode.com/problems/remove-duplicates-from-sorted-array/ 1. 题目介绍 Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new le...原创 2019-03-17 22:17:25 · 124 阅读 · 0 评论 -
[LeetCode] 344. Reverse String
原题链接:https://leetcode.com/problems/reverse-string/ 1. 题目介绍 Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another ...原创 2019-03-20 12:03:39 · 112 阅读 · 0 评论 -
[LeetCode] 35. Search Insert Position
原题链接: https://leetcode.com/problems/search-insert-position/ 1. 题目介绍 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 w...原创 2019-05-07 20:56:29 · 107 阅读 · 0 评论