大家好,我是毛毛。ヾ(´∀ ˋ)ノ
废话不多说开始今天的解题Day~
We define the usage of capitals in a word to be right when one of the following cases holds:
"USA"
."leetcode"
."Google"
.Given a string word
, return true
if the usage of capitals in it is right.
Input: word = "USA"
Output: true
Input: word = "FlaG"
Output: false
1 <= word.length <= 100
word
consists of lowercase and uppercase English letters.首先先简单的翻译一下题目
给一个字串,判断是不是符合题目的规则。
作法大致上是这样
class Solution:
def isPalindrome(self, x: int) -> bool:
x = str(x)
left = 0
right = len(x)-1
while left < right:
if x[left] != x[right]:
return False
left += 1
right -= 1
return True
大家明天见
>>: 找LeetCode上简单的题目来撑过30天啦(DAY27)
今天练习的主题是用Vue实现列表的展开与隐藏功能 会分为两个范例让大家做演练 范例一 先将isSho...
这个的前一篇是~https://ithelp.ithome.com.tw/articles/1024...
今天继续来讲阵列,想说都剩没多少,不如就一次介绍完呗,这样以後翻笔记才不会翻半天还找不到东西(大家应...
boxing: 封装可以让原始型态的资料暂时转成物件,这样他才可以使用属性或方法。 遇到使用字面值(...
前一篇IMPORT中,提到Genero Package中有提供一些预先制作的功能套件可用。 可是面对...