摘要: Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non 阅读全文
posted @ 2020-07-14 23:28 whatyouthink 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they 阅读全文
posted @ 2020-07-14 23:17 whatyouthink 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 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 complexi 阅读全文
posted @ 2020-07-14 23:05 whatyouthink 阅读(93) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an inte 阅读全文
posted @ 2020-07-14 22:56 whatyouthink 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Given an array A of integers, return true if and only if it is a valid mountain array. Recall that A is a mountain array if and only if: A.length >= 3 阅读全文
posted @ 2020-07-14 22:46 whatyouthink 阅读(73) 评论(0) 推荐(0) 编辑
摘要: We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). N 阅读全文
posted @ 2020-07-14 22:33 whatyouthink 阅读(97) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the  阅读全文
posted @ 2020-07-14 22:21 whatyouthink 阅读(73) 评论(0) 推荐(0) 编辑
摘要: Given an array arr of integers, check if there exists two integers N and M such that N is the double of M ( i.e. N = 2 * M). More formally check if th 阅读全文
posted @ 2020-07-14 22:16 whatyouthink 阅读(95) 评论(0) 推荐(0) 编辑
摘要: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and num 阅读全文
posted @ 2020-07-14 22:12 whatyouthink 阅读(76) 评论(0) 推荐(0) 编辑
摘要: Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the 阅读全文
posted @ 2020-07-14 22:03 whatyouthink 阅读(87) 评论(0) 推荐(0) 编辑
摘要: In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as 阅读全文
posted @ 2020-07-14 21:58 whatyouthink 阅读(100) 评论(0) 推荐(0) 编辑
摘要: In a row of seats, 1 represents a person sitting in that seat, and 0 represents that the seat is empty. There is at least one empty seat, and at least 阅读全文
posted @ 2020-07-14 21:51 whatyouthink 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 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 or 阅读全文
posted @ 2020-07-14 21:26 whatyouthink 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of digits representing a non-negative integer, increment one to the integer. The digits are stored such that the most signific 阅读全文
posted @ 2020-07-14 21:21 whatyouthink 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the sum of 阅读全文
posted @ 2020-07-14 00:13 whatyouthink 阅读(77) 评论(0) 推荐(0) 编辑