shuaijiang's blog
  • 首页
  • 归档
  • 分类
  • 标签
  • 关于

leetcode Sum of Left Leaves

DescriptionFind the sum of all left leaves in a given binary tree. Example: 1234567 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively.
1月 23 2017
#leetcode

LeetCode Intersection of Two Arrays

DescriptionGiven 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 resul
1月 23 2017
#leetcode

LeetCode Verify Preorder Serialization of a Binary Tree

DescriptionOne way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node’s value. If it is a null node, we record using a sentinel value such
1月 23 2017
#leetcode

LeetCode Two Sum II Input array is sorted

DescriptionGiven 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 twoSum should return indices of the tw
1月 19 2017
#leetcode

LeetCode Top K Frequent Elements

DescriptionGiven 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].Note: You may assume k is always valid, 1 ≤ k ≤ number of
1月 19 2017
#leetcode

LeetCode Longest Palindrome

DescriptionGiven a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensitive, for example “Aa” is
1月 19 2017
#leetcode

LeetCode Battleships in a Board

DescriptionGiven an 2D board, count how many different battleships are in it. The battleships are represented with ‘X’s, empty slots are represented with ‘.’s. You may assume the following rules: You
1月 19 2017
#leetcode

LeetCode Magical String

DescriptionA magical string S consists of only ‘1’ and ‘2’ and obeys the following rules: The string S is magical because concatenating the number of contiguous occurrences of characters ‘1’ and ‘2’ g
1月 19 2017
#leetcode

LeetCode Island Perimeter

DescriptionYou are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is
1月 11 2017
#leetcode

LeetCode Hamming Distance

DescriptionThe Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Note:0 ≤ x, y
1月 10 2017
#leetcode
12345…26

搜索

Hexo Fluid
总访问量 次 总访客数 人