摘要: Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums 阅读全文
posted @ 2018-01-13 18:37 chenhan233 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 阅读全文
posted @ 2018-01-13 18:36 chenhan233 阅读(86) 评论(0) 推荐(0) 编辑
摘要: iven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in ord 阅读全文
posted @ 2018-01-13 18:35 chenhan233 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2018-01-13 18:34 chenhan233 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might 阅读全文
posted @ 2018-01-13 18:32 chenhan233 阅读(65) 评论(0) 推荐(0) 编辑
摘要: Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A. We want to find 阅读全文
posted @ 2018-01-13 18:30 chenhan233 阅读(77) 评论(0) 推荐(0) 编辑
摘要: A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the 阅读全文
posted @ 2018-01-13 18:28 chenhan233 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th 阅读全文
posted @ 2018-01-13 18:25 chenhan233 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2018-01-13 18:24 chenhan233 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t 阅读全文
posted @ 2018-01-13 18:23 chenhan233 阅读(111) 评论(0) 推荐(0) 编辑