Last active
June 11, 2019 13:21
-
-
Save edward-hsu-1994/ad5d1a91a5911545371f8fb332c76fee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string Test2(string str) { | |
if (str.Length == 0) return str; | |
return str[str.Length - 1] + Test2(str.Substring(0, str.Length - 1)); | |
} | |
public static string Test3(string str) { | |
if (str.Length < 4) return str; | |
return Test3(str.Substring(0, str.Length - 3)) + "," + str.Substring(str.Length - 3); | |
} | |
public static int? Test4(int[] vals, int index = 0, int? result = null) { | |
if (vals.Length == 0 || index == vals.Length) return result; | |
return Test4(vals, index + 1, result > vals[index] ? result.Value : vals[index]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment