摘要: 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-05-05 14:31 何以解忧,唯有撸代码 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Given an array, rotate the array to the right by k steps, where k is non-negative. 题目:给定一个数组和一个数值k,要求将数组向右旋转k步。 以前准备面试时看到过这个题目,结果今天还是记不得空间复杂度O(1)的解法,好 阅读全文
posted @ 2018-05-05 14:09 何以解忧,唯有撸代码 阅读(113) 评论(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-05-05 13:34 何以解忧,唯有撸代码 阅读(77) 评论(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-05-05 12:03 何以解忧,唯有撸代码 阅读(110) 评论(0) 推荐(0) 编辑