摘要: 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, 阅读全文
posted @ 2016-07-20 13:47 Roger's 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. 题目:升级版找两个数组的交集,初级 阅读全文
posted @ 2016-07-20 13:30 Roger's 阅读(106) 评论(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 @ 2016-07-20 13:25 Roger's 阅读(177) 评论(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 @ 2016-07-20 13:22 Roger's 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example:Given n = 2, return 91. (The answer should be the 阅读全文
posted @ 2016-07-20 11:29 Roger's 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: pu 阅读全文
posted @ 2016-07-20 11:09 Roger's 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", t = 阅读全文
posted @ 2016-07-20 11:04 Roger's 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. 题目:意思很简单就是,找出数组中出现规 阅读全文
posted @ 2016-07-20 10:33 Roger's 阅读(190) 评论(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 @ 2016-07-20 10:28 Roger's 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2016-07-20 10:16 Roger's 阅读(147) 评论(0) 推荐(0) 编辑