Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 464 Bytes

434._number_of_segments_in_a_string.md

File metadata and controls

27 lines (17 loc) · 464 Bytes

434. Number of Segments in a String

题目: https://leetcode.com/problems/number-of-segments-in-a-string/

难度:

Easy

作弊神器Python

class Solution(object):
    def countSegments(self, s):
        """
        :type s: str
        :rtype: int
        """
        return len(s.split())

不过对于比如C++这种语言来说,应该是O(N),扫一圈应该也能得到正确答案

总之拿Python做string的题目就是作弊啊