摘要: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t 阅读全文
posted @ 2018-09-29 23:50 静静地挖坑 阅读(297) 评论(0) 推荐(0)
摘要: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2018-09-29 23:22 静静地挖坑 阅读(128) 评论(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 @ 2018-09-29 22:57 静静地挖坑 阅读(177) 评论(0) 推荐(0)
摘要: 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 arr 阅读全文
posted @ 2018-09-29 20:51 静静地挖坑 阅读(133) 评论(0) 推荐(0)
摘要: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2018-09-29 20:31 静静地挖坑 阅读(101) 评论(0) 推荐(0)
摘要: 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 阅读全文
posted @ 2018-09-29 20:07 静静地挖坑 阅读(115) 评论(0) 推荐(0)
摘要: 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] 阅读全文
posted @ 2018-09-29 15:04 静静地挖坑 阅读(179) 评论(0) 推荐(0)
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: 原题地址: M 阅读全文
posted @ 2018-09-29 14:26 静静地挖坑 阅读(92) 评论(0) 推荐(0)
摘要: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2018-09-29 13:18 静静地挖坑 阅读(120) 评论(0) 推荐(0)
摘要: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: 原题地址: Max Consecutive Ones 难度: Easy 题意: 找出连续为1的子数组的最大长度 思路1: 阅读全文
posted @ 2018-09-29 12:18 静静地挖坑 阅读(323) 评论(0) 推荐(0)
摘要: Alice and Bob have candy bars of different sizes: A[i] is the size of the i-th bar of candy that Alice has, and B[j] is the size of the j-th bar of ca 阅读全文
posted @ 2018-09-29 11:23 静静地挖坑 阅读(126) 评论(0) 推荐(0)