leetcode题目
文章平均质量分 70
chenhan233
这个作者很懒,什么都没留下…
展开
-
[leetcode]Array-697. Degree of an Array
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 task is to find the smallest possible length o原创 2018-01-13 09:18:34 · 162 阅读 · 0 评论 -
[leetcode]Backtracking-39. Combination Sum
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 to T. The same repeated number may be chosen原创 2018-01-13 09:40:56 · 142 阅读 · 0 评论 -
[leetcode]Two Pointers-344. Reverse String
Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh".char* reverseString(char* s) { 2 assert(s != NULL); 3 int len= str原创 2018-01-13 09:38:43 · 125 阅读 · 0 评论 -
[leetcode]Binary Search-35. Search Insert Position
Given 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 order. You may assume no duplicates in the array.原创 2018-01-13 09:36:36 · 126 阅读 · 0 评论 -
[leetcode]Depth-first Search-695. Max Area of Island
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.) You may assume all four edges of the grid are su原创 2018-01-13 09:35:00 · 138 阅读 · 0 评论 -
[leetcode]Tree-669. Trim a Binary Search Tree
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 need to change the root of the tree, so the r原创 2018-01-13 09:32:47 · 107 阅读 · 0 评论 -
[leetcode] Hash Table-760. Find Anagram Mappings
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 an index mapping P, from A to B. A mappin原创 2018-01-13 09:30:58 · 213 阅读 · 0 评论 -
[leetcode]Math-413. Arithmetic Slices
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 same. For example, these are arithmetic sequence:原创 2018-01-13 09:28:35 · 146 阅读 · 0 评论 -
[leetcode]String-696. Count Binary Substrings
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 these substrings are grouped consecutively. Su原创 2018-01-13 09:26:22 · 194 阅读 · 0 评论 -
[leetcode]Dynamic Programming-121. Best Time to Buy and Sell Stock
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 (ie, buy one and sell one share of the stock), d原创 2018-01-13 09:22:41 · 183 阅读 · 0 评论