Loading

随笔分类 -  Leetcode

摘要:Given two strings s and p, return an array of all the start indices of p's anagrams in s. You may return the answer in any order. An Anagram is a word 阅读全文
posted @ 2022-02-02 17:24 aalanwyr 阅读(64) 评论(0) 推荐(0)
摘要:Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1,2, 阅读全文
posted @ 2022-01-30 11:12 aalanwyr 阅读(74) 评论(0) 推荐(0)
摘要:Given two binary search trees root1 and root2, return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: 阅读全文
posted @ 2022-01-27 13:49 aalanwyr 阅读(53) 评论(0) 推荐(0)
摘要:Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: arr.lengt 阅读全文
posted @ 2022-01-25 22:10 aalanwyr 阅读(59) 评论(0) 推荐(0)
摘要:We define the usage of capitals in a word to be right when one of the following cases holds: All letters in this word are capitals, like "USA". All le 阅读全文
posted @ 2022-01-24 12:55 aalanwyr 阅读(52) 评论(0) 推荐(0)
摘要:An integer has sequential digits if and only if each digit in the number is one more than the previous digit. Return a sorted list of all the integers 阅读全文
posted @ 2022-01-23 23:14 aalanwyr 阅读(71) 评论(0) 推荐(0)
摘要:There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]. You have a car with an unlimited gas tank and i 阅读全文
posted @ 2022-01-22 01:06 aalanwyr 阅读(170) 评论(0) 推荐(0)
摘要:Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours. Koko c 阅读全文
posted @ 2022-01-21 00:36 aalanwyr 阅读(71) 评论(0) 推荐(0)
摘要:There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where 阅读全文
posted @ 2022-01-14 09:21 aalanwyr 阅读(66) 评论(0) 推荐(0)
摘要:You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It 阅读全文
posted @ 2022-01-12 18:19 aalanwyr 阅读(60) 评论(0) 推荐(0)
摘要:ou are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most si 阅读全文
posted @ 2022-01-11 23:23 aalanwyr 阅读(61) 评论(0) 推荐(0)
摘要:最近事情比较多,耽误了。。。。。。 Given two binary strings a and b, return their sum as a binary string. Example 1: Input: a = "11", b = "1" Output: "100" Example 2: 阅读全文
posted @ 2022-01-10 17:51 aalanwyr 阅读(52) 评论(0) 推荐(0)
摘要:The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binary representation. For example, 阅读全文
posted @ 2022-01-04 22:39 aalanwyr 阅读(68) 评论(0) 推荐(0)
摘要:In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge. If the town judge exists, the 阅读全文
posted @ 2022-01-03 19:07 aalanwyr 阅读(59) 评论(0) 推荐(0)
摘要:You are given a list of songs where the ith song has a duration of time[i] seconds. Return the number of pairs of songs for which their total duration 阅读全文
posted @ 2022-01-03 00:30 aalanwyr 阅读(69) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, find the maximum value v for which there exist different nodes a and b where v = |a.val - b.val| and a is an ancestor 阅读全文
posted @ 2021-12-31 11:51 aalanwyr 阅读(65) 评论(0) 推荐(0)
摘要:Given a positive integer k, you need to find the length of the smallest positive integer n such that n is divisible by k, and n only contains the digi 阅读全文
posted @ 2021-12-30 15:23 aalanwyr 阅读(103) 评论(0) 推荐(0)
摘要:Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node. Examp 阅读全文
posted @ 2021-12-28 23:52 aalanwyr 阅读(77) 评论(0) 推荐(0)
摘要:Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation. Note: You are  阅读全文
posted @ 2021-12-27 20:19 aalanwyr 阅读(56) 评论(0) 推荐(0)
摘要:Given a string s which represents an expression, evaluate this expression and return its value. The integer division should truncate toward zero. You 阅读全文
posted @ 2021-12-27 20:15 aalanwyr 阅读(61) 评论(0) 推荐(0)