![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
shaobo Huang
化繁为简,高效极致
展开
-
Insert Interval(Leetcode57)
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:Input: intervals = [[1,3],[6,9]], newInterval = [2,原创 2020-11-04 20:53:35 · 225 阅读 · 0 评论 -
Binary Tree Paths(leetcode 257)
Given a binary tree, return all root-to-leaf paths.Note: A leaf is a node with no children.Example:Input: 1 / \2 3 \ 5Output: ["1->2->5", "1->3"]Explanation: All root-to-leaf paths are: 1->2->5, 1->3给定一个二叉树,返回所有从根节原创 2020-09-04 11:43:02 · 166 阅读 · 0 评论 -
Rearrange Words in a Sentence(Leetcode1451)
Given a sentence text (A sentence is a string of space-separated words) in the following format:First letter is in upper case.Each word in text are separated by a single space.Your task is to rearrange the words in text such that all words are rearran原创 2020-08-17 13:34:29 · 237 阅读 · 0 评论 -
Merge Sorted Array(Leetcode88)
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums2 are m and n respectively.You may assume that nums1 has enough space (size that is equal to m + n) to h原创 2020-08-13 18:01:46 · 160 阅读 · 0 评论 -
Daily Temperatures(leetcode739)
Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this is possible, put 0 instead.For example, given the原创 2020-08-11 08:53:24 · 186 阅读 · 0 评论 -
Power of Two(Leetcode231)
Given an integer, write a function to determine if it is a power of two.Example 1:Input: 1Output: true Explanation: 20 = 1Example 2:Input: 16Output: trueExplanation: 24 = 16Example 3:Input: 218Output: false给定一个整数,编写一个函数来判断它是否是 2 的幂次方。示例 1:原创 2020-08-06 09:37:33 · 193 阅读 · 0 评论 -
Power of Four(Leetcode 342)
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example 1:Input: 16Output: trueExample 2:Input: 5Output: falseFollow up: Could you solve it without loops/recursion?给定一个整数(带符号的32位),编写一个函数检查其是否为4的幂。范例1:输入:16原创 2020-08-04 18:13:33 · 171 阅读 · 0 评论 -
Combine Two Tables(leetcode 175)
Table: PersonColumn NameTypePersonIdintFirstNamevarcharLastNamevarcharPersonId is the primary key column for this table.Table: AddressColumn NameTypeAddressIdintPersonIdintCityvarcharStatevarcharAddressId原创 2020-08-04 17:45:48 · 144 阅读 · 0 评论 -
Word Frequency(Leetcode192)
Write a bash script to calculate the frequency of each word in a text file words.txt.For simplicity sake, you may assume:words.txt contains only lowercase characters and space ’ ’ characters.Each word must consist of lowercase characters only.Words are原创 2020-08-04 16:33:00 · 226 阅读 · 0 评论 -
Fizz Buzz(Leetcode412)
#!/bin/python3import mathimport osimport randomimport reimport sys## Complete the 'fizzBuzz' function below.## The function accepts INTEGER n as parameter.#def fizzBuzz(n): # Write your code here for i in range(1,n+1): if i.原创 2020-07-30 23:38:03 · 243 阅读 · 0 评论 -
Add Two Numbers(Leetcode002)
'''You are given two non-empty linked lists representing two non-negative integers.The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and ret...原创 2019-11-01 10:43:21 · 105 阅读 · 0 评论 -
Longest Substring Without Repeating Characters(Leetcode003)
Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:Inpu...原创 2019-10-24 09:54:35 · 157 阅读 · 0 评论 -
Two Sum(Leetcode001)
'''Given an array of integers, return indices of the two numbers such that they add up to a specifictarget.You may assume that each input would have exactly one solution, and you may not use the sa...原创 2019-10-22 12:25:13 · 103 阅读 · 0 评论