摘要:
Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:Each element in the result should appear as many times as it sho... 阅读全文
posted @ 2017-01-10 23:10
xiejunzhao
阅读(127)
评论(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 array is non-empty and the majority element always... 阅读全文
posted @ 2017-01-10 23:09
xiejunzhao
阅读(135)
评论(0)
推荐(0)
摘要:
217. Contains DuplicateGiven 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 array, and it should return fa... 阅读全文
posted @ 2017-01-10 23:09
xiejunzhao
阅读(128)
评论(0)
推荐(0)
摘要:
错误1"aa""bb"static public bool IsAnagram(string s, string t) { int sLength = s.Length; int tLength = t.Length; if (sLength != tLength) { return false; } char c = ' '; int value = 0; Dictionary d = new... 阅读全文
posted @ 2017-01-10 23:08
xiejunzhao
阅读(298)
评论(0)
推荐(0)
摘要:
Excel Sheet Column NumberRelated to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C ->... 阅读全文
posted @ 2017-01-10 23:07
xiejunzhao
阅读(106)
评论(0)
推荐(0)
摘要:
递归实现static public bool IsSameTree(TreeNode root1, TreeNode root2) { if (root1 == null && root2 == null) { return true; } if ((root1 == null && root2 != null) || (root1 != null && root2 == null)) { r... 阅读全文
posted @ 2017-01-10 23:07
xiejunzhao
阅读(3027)
评论(0)
推荐(0)
摘要:
Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be unique.The result can be in any ... 阅读全文
posted @ 2017-01-10 23:05
xiejunzhao
阅读(153)
评论(0)
推荐(0)
摘要:
QuestionWrite a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with v... 阅读全文
posted @ 2017-01-10 23:05
xiejunzhao
阅读(122)
评论(0)
推荐(0)
摘要:
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode" return 0. s = "loveleetcode", return 2. Note: You may assume... 阅读全文
posted @ 2017-01-10 23:05
xiejunzhao
阅读(281)
评论(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 ransom note can be constructed from the magazines ; ot... 阅读全文
posted @ 2017-01-10 23:04
xiejunzhao
阅读(177)
评论(0)
推荐(0)

浙公网安备 33010602011771号