![]() |
VOOZH | about |
Given a string s, the task is to find the length of the string.
Examples:
Input: s = "abc"
Output: 3Input: s = "GeeksforGeeks"
Output: 13Input: s = ""
Output: 0
Every programming language offers a built-in method as well to find the length
3
Programming Language | In-Built method to find the length of the string |
|---|---|
C | |
C++ | |
Java | |
Python | |
JavaScript | |
C# |
The most traditional method of finding the length of the string is by traversing each character through the loop.
13
Time Complexity: O(n), where n is the length of the string.
Auxiliary space: O(1)