AceInfinity
Emeritus, Contributor
Here's a challenge for you guys !
Objective:
Write a function that returns the length of a string variable.
The Catch/Guidelines:
- Write a recursive function that only takes one parameter (of type string). Example:
- This cannot be an iterative function, it must be recursive
- You cannot use any counter variable to keep track
- You cannot use any of the properties available to the string class or type (depending on what language you're using). (Ex: No use of the Length property for strings in .NET, no len() in Python, etc...)
I completed this in C#, and Python so far, lets see who else can do it!
:thumbsup2:
Objective:
Write a function that returns the length of a string variable.
The Catch/Guidelines:
- Write a recursive function that only takes one parameter (of type string). Example:
Code:
public static int GetStrLen(string input)
{
// Get the length of the string: input
// Return the value for the length of this string
// Keep in mind the rules...
{
- You cannot use any counter variable to keep track
- You cannot use any of the properties available to the string class or type (depending on what language you're using). (Ex: No use of the Length property for strings in .NET, no len() in Python, etc...)
I completed this in C#, and Python so far, lets see who else can do it!
:thumbsup2: