推 oin1104: 非常好題目 10/20 22:34
非常好題目
很適合當作leetcode入門題
一二三四五
def finalValueAfterOperations(self, operations: List[str]) -> int:
rets = 0
for op in operations:
if op=='++X' or op=='X++':
rets += 1
else:
rets -= 1
return rets
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.132.58.28 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1760970510.A.265.html