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...
899 1 分鐘

⭐️ # 題目敘述 You have a set of integers s , which originally contains all the numbers from 1 to n . Unfortunately, due to some error, one of the numbers in s got duplicated to another number in the set, which results in repetition of one number and loss of another number. You are given an integer array...
1.4k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two...
1.2k 1 分鐘

# 臺灣麻將規則 由於我們是要寫麻將對局,不是要當賭神😝,所以我這裡只列出幾個需要關注的內容,一些過於細節的就不多加描述。 # 排組介紹 一副麻將總共 144 張牌 136 張基本牌,每種各四張 1 ~ 9 萬 1 ~ 9 條 1 ~ 9 筒 中、發、白 東、南、西、北 4 張花牌 梅、蘭、竹、菊 4 張四季牌 春、夏、秋、冬 # 動作 抓位: 每圈開始前,大家把東、南、西、北風牌放到桌上,並且蓋上,四家任意各拿一張牌後,依照所拿到的風牌決定座位,就叫做「麻將抓位」。 補花:...