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())