Lunski's Clutter

This is a place to put my clutters, no matter you like it or not, welcome here.

0%

Write a function to find the longest common prefix string amongst an array of strings.

If there is no common prefix, return an empty string “”.

Example 1:

1
2
Input: strs = ["flower","flow","flight"]
Output: "fl"

Example 2:

1
2
3
Input: strs = ["dog","racecar","car"]
Output: ""
Explanation: There is no common prefix among the input strings.

Constraints:

1
2
3
0 <= strs.length <= 200
0 <= strs[i].length <= 200
strs[i] consists of only lower-case English letters.
Read more »

Given a 32-bit signed integer, reverse digits of an integer.

Note: Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For this problem, assume that your function returns 0 when the reversed integer overflows.

Example 1:

1
2
Input: x = 123
Output: 321

Example 2:

1
2
Input: x = -123
Output: -321

Example 3:

1
2
Input: x = 120
Output: 21

Example 4:

1
2
Input: x = 0
Output: 0

Constraints:

1
-2ˆ31 <= x <= 231 - 1
Read more »

上次跟大家提到重訓的吃,接下來就是開始動,問題是怎麼動呢? 其實我一開始也不知道,所以這份課表叫十里坡,在不斷努力後,還是練成了劍神。

Read more »

Given an integer n, return true if it is a power of three. Otherwise, return false.

An integer n is a power of three, if there exists an integer x such that n == 3x.

Example 1:

1
2
Input: n = 27
Output: true

Example 2:

1
2
Input: n = 0
Output: false

Example 3:

1
2
Input: n = 9
Output: true

Example 4:

1
2
Input: n = 45
Output: false
Read more »