
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 · 283 阅读 · 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 \ 5 Output: ["1->2->5", "1->3"] Explanation: All root-to-leaf paths are: 1->2->5, 1->3 给定一个二叉树,返回所有从根节原创 2020-09-04 11:43:02 · 205 阅读 · 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 · 283 阅读 · 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 · 187 阅读 · 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 · 224 阅读 · 0 评论 -
Power of Two(Leetcode231)
Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 Output: true Explanation: 24 = 16 Example 3: Input: 218 Output: false 给定一个整数,编写一个函数来判断它是否是 2 的幂次方。 示例 1:原创 2020-08-06 09:37:33 · 234 阅读 · 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: 16 Output: true Example 2: Input: 5 Output: false Follow up: Could you solve it without loops/recursion? 给定一个整数(带符号的32位),编写一个函数检查其是否为4的幂。 范例1: 输入:16原创 2020-08-04 18:13:33 · 215 阅读 · 0 评论 -
Combine Two Tables(leetcode 175)
Table: Person Column Name Type PersonId int FirstName varchar LastName varchar PersonId is the primary key column for this table. Table: Address Column Name Type AddressId int PersonId int City varchar State varchar AddressId原创 2020-08-04 17:45:48 · 173 阅读 · 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 · 268 阅读 · 0 评论 -
Fizz Buzz(Leetcode412)
#!/bin/python3 import math import os import random import re import 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 · 282 阅读 · 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 · 138 阅读 · 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 · 187 阅读 · 0 评论 -
Two Sum(Leetcode001)
''' Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the sa...原创 2019-10-22 12:25:13 · 133 阅读 · 0 评论