摘要: [题目]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-08-18 22:19 三刀 阅读(143) 评论(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 th 阅读全文
posted @ 2016-08-18 19:45 三刀 阅读(102) 评论(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 tha 阅读全文
posted @ 2016-08-18 00:59 三刀 阅读(137) 评论(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" 阅读全文
posted @ 2016-08-17 21:01 三刀 阅读(153) 评论(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 identi 阅读全文
posted @ 2016-08-16 22:44 三刀 阅读(125) 评论(0) 推荐(0) 编辑
摘要: [题目] Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. [题目解析] 这是一个很简单的 阅读全文
posted @ 2016-08-14 18:01 三刀 阅读(125) 评论(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. For example 阅读全文
posted @ 2016-08-14 16:25 三刀 阅读(96) 评论(0) 推荐(0) 编辑
摘要: [题目] Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the 阅读全文
posted @ 2016-08-14 15:44 三刀 阅读(529) 评论(0) 推荐(0) 编辑
摘要: [题目] Invert a binary tree. to 阅读全文
posted @ 2016-08-14 14:03 三刀 阅读(130) 评论(0) 推荐(0) 编辑
摘要: [题目] Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farth 阅读全文
posted @ 2016-08-14 13:35 三刀 阅读(124) 评论(0) 推荐(0) 编辑