Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 286 Bytes

434.md

File metadata and controls

23 lines (14 loc) · 286 Bytes

434. Number of Segments in a String

Description

link


Solution

  • See Code

Code

O(n)

class Solution:
    def countSegments(self, s: str) -> int:
        return len(s.split())