Leetcode
Summer8918
这个作者很懒,什么都没留下…
展开
-
11. Container With Most Water
Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two l...翻译 2020-04-18 20:38:13 · 174 阅读 · 0 评论 -
leetcode 114. Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: 1 / 2 5 / \ 3 4 6 The flattened tree should look like: 1 \ 2 \ 3 \ 4 \ 5 \ 6 解法1:前序遍历二叉树。中-&...原创 2020-03-22 18:21:47 · 97 阅读 · 0 评论 -
leetcode 164. Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains less than 2 elements. Example 1: Input: [3,6,9,1] Output: 3 Expl...原创 2020-03-07 23:58:55 · 74 阅读 · 0 评论 -
190. Reverse Bits
Reverse bits of a given 32 bits unsigned integer. Example 1: Input: 00000010100101000001111010011100 Output: 00111001011110000010100101000000 Explanation: The input binary string 000000101001010000011...转载 2020-01-14 23:52:20 · 101 阅读 · 0 评论 -
leetcode 207: Course Schedule
leetcode 207. Course Schedule There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1,...转载 2020-01-05 11:35:55 · 81 阅读 · 0 评论 -
14. Longest Common Prefix
M1: class Solution { public: string longestCommonPrefix(vector<string>& strs) { int num=strs.size(); if(num==0) return ""; if(num==1) return strs[0]; int ...转载 2019-07-21 17:01:54 · 70 阅读 · 0 评论 -
17. Letter Combinations of a Phone Number
Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is give...转载 2019-07-21 19:43:04 · 88 阅读 · 0 评论