随笔分类 - leetcode
摘要:Can Place Flowers You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent p
阅读全文
摘要:LongestContinuous Increasing Subsequence Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence
阅读全文
摘要:Baseball Game You are keeping the scores for a baseball game with strange rules. At the beginning of the game, you start with an empty record. You are
阅读全文
摘要:Excel Sheet Column Number Given a string columnTitle that represents the column title as appears in an Excel sheet, return its corresponding column nu
阅读全文
摘要:Implement Stack using Queues Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions
阅读全文
摘要:Palindrome Linked List Given the head of a singly linked list, return true if it is a palindrome or false otherwise. Example 1: Input: head = [1,2,2,1
阅读全文
摘要:Max Consecutive Ones Given a binary array nums, return the maximum number of consecutive 1's in the array. Example 1: Input: nums = [1,1,0,1,1,1] Outp
阅读全文
摘要:Number of Segments in a String Given a string s, return the number of segments in the string. A segment is defined to be a contiguous sequence of non-
阅读全文
摘要:Next Greater Element I The next greater element of some element x in an array is the first greater element that is to the right of x in the same array
阅读全文
摘要:Longest Uncommon Subsequence I Given two strings a and b, return the length of the longest uncommon subsequence between a and b. If the longest uncomm
阅读全文
摘要:Student Attendance Record I You are given a string s representing an attendance record for a student where each character signifies whether the studen
阅读全文
摘要:Longest Palindrome Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built wi
阅读全文
摘要:Reverse Vowels of a String Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and
阅读全文
摘要:Maximum Average Subarray I You are given an integer array nums consisting of n elements, and an integer k. Find a contiguous subarray whose length is
阅读全文
摘要:Binary Tree Tilt Given the root of a binary tree, return the sum of every tree node's tilt. The tilt of a tree node is the absolute difference between
阅读全文
摘要:Intersection of Two Arrays Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique
阅读全文
摘要:Intersection of Two Arrays II Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear
阅读全文
摘要:Valid Perfect Square Given a positive integer num, return true if num is a perfect square or false otherwise. A perfect square is an integer that is t
阅读全文
摘要:First Unique Character in a String Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -
阅读全文
摘要:Third Maximum Number Given an integer array nums, return the third distinct maximum number in this array. If the third maximum does not exist, return
阅读全文

浙公网安备 33010602011771号