Number of Segments in a String Problem
Number of Segments in a String Problem — ExecCode Easy DSA Practice
Solve the Number of Segments in a String problem on ExecCode. Free online easy DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.
Description Given a string s, return the number of segments in the string. A segment is defined to be a contiguous sequence of non-space characters. Examples Example 1 Input: s = "Hello, my name is John" Output: 5 Explanation: The five segments are ["Hello,", "my", "name", "is",…
Practice Number of Segments in a String free on ExecCode. Browse more ExecCode DSA problems.