778 1 分鐘

⭐️⭐️⭐️ # 題目敘述 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 in the range [low, high] inclusive that have sequential digits. # Example 1 Input: low = 100, high = 300 Output: [123,234] # Example...
1.2k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 You are given an integer array nums of size n and a positive integer k . Divide the array into one or more arrays of size 3 satisfying the following conditions: Each element of nums should be in exactly one array. The difference between any two elements in one array is less than or...
1.3k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0...
2.4k 2 分鐘

⭐️⭐️⭐️ # 題目敘述 You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation. Evaluate the expression. Return an integer that represents the value of the expression. Note that: The valid operators are '+' , '-' , '*' , and...
2.7k 2 分鐘

⭐️ # 題目敘述 Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue ( push , peek , pop , and empty ). Implement the MyQueue class: void push(int x) Pushes element x to the back of the queue. int pop() Removes the...
894 1 分鐘

⭐️⭐️⭐️⭐️⭐️ # 題目敘述 For an integer array nums , an inverse pair is a pair of integers [i, j] where 0 <= i < j < nums.length and nums[i] > nums[j] . Given two integers n and k, return the number of different arrays consist of numbers from 1 to n such that there are exactly k...
1.1k 1 分鐘

⭐️⭐️⭐️⭐️ # 題目敘述 There is an m x n grid with a ball. The ball is initially at the position [startRow, startColumn] . You are allowed to move the ball to one of the four adjacent cells in the grid (possibly out of the grid crossing the grid boundary). You can apply at most maxMove moves to the...
1.7k 2 分鐘

⭐️⭐️⭐️ # 題目敘述 Given two strings text1 and text2 , return the length of their longest common subsequence. If there is no common subsequence, return 0 . A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative...
1.9k 2 分鐘

⭐️⭐️⭐️ # 題目敘述 Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be pseudo-palindromic if at least one permutation of the node values in the path is a palindrome. Return the number of pseudo-palindromic paths going from the root node to leaf nodes. #...
1.5k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 You are given an array of strings arr . A string s is formed by the concatenation of a subsequence of arr that has unique characters. Return the maximum possible length of s . A subsequence is an array that can be derived from another array by deleting some or no elements without...