随笔分类 -  leetcode

摘要:https://leetcode-cn.com/problems/fu-za-lian-biao-de-fu-zhi-lcof/ /* struct RandomListNode { int label; struct RandomListNode *next, *random; RandomLis 阅读全文
posted @ 2021-05-14 11:15 米开朗菠萝 阅读(27) 评论(0) 推荐(0)
摘要:解题思路: 代码: class Solution: def myPow(self, x: float, n: int) -> float: if x == 0: return 0 res = 1 if n < 0: x, n = 1 / x, -n while n: if n & 1: res *= 阅读全文
posted @ 2021-04-28 09:02 米开朗菠萝 阅读(43) 评论(0) 推荐(0)
摘要: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 warme 阅读全文
posted @ 2020-05-06 14:36 米开朗菠萝 阅读(149) 评论(0) 推荐(0)
摘要:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文
posted @ 2020-03-31 22:54 米开朗菠萝 阅读(93) 评论(0) 推荐(0)
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2020-03-31 22:17 米开朗菠萝 阅读(138) 评论(0) 推荐(0)
摘要:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2020-03-31 16:27 米开朗菠萝 阅读(89) 评论(0) 推荐(0)
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two di 阅读全文
posted @ 2020-03-31 15:28 米开朗菠萝 阅读(92) 评论(0) 推荐(0)
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2020-03-31 15:20 米开朗菠萝 阅读(100) 评论(0) 推荐(0)
摘要:Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexi 阅读全文
posted @ 2020-03-30 12:08 米开朗菠萝 阅读(155) 评论(0) 推荐(0)
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1: Input: [3,0,1] Output 阅读全文
posted @ 2020-03-30 11:38 米开朗菠萝 阅读(120) 评论(0) 推荐(0)
摘要:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the  阅读全文
posted @ 2020-03-29 20:57 米开朗菠萝 阅读(104) 评论(0) 推荐(0)
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2020-03-29 20:04 米开朗菠萝 阅读(108) 评论(0) 推荐(0)
摘要:Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] 阅读全文
posted @ 2020-03-29 19:59 米开朗菠萝 阅读(141) 评论(0) 推荐(0)
摘要:At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bil 阅读全文
posted @ 2020-03-29 17:49 米开朗菠萝 阅读(135) 评论(0) 推荐(0)
摘要:A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one p 阅读全文
posted @ 2020-03-29 17:20 米开朗菠萝 阅读(180) 评论(0) 推荐(0)
摘要:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g 阅读全文
posted @ 2020-03-29 13:50 米开朗菠萝 阅读(136) 评论(0) 推荐(0)
摘要:There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the hor 阅读全文
posted @ 2020-03-29 11:34 米开朗菠萝 阅读(99) 评论(0) 推荐(0)
摘要:Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The l 阅读全文
posted @ 2020-03-29 10:09 米开朗菠萝 阅读(130) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2020-03-25 19:59 米开朗菠萝 阅读(132) 评论(0) 推荐(0)
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
posted @ 2020-03-25 19:39 米开朗菠萝 阅读(125) 评论(0) 推荐(0)