add new file: c# reverse words in string
parent
d1f7426a61
commit
b1333bcad6
|
@ -30,6 +30,7 @@ To run the `.cs` file, kindly use [.Net Finddle](https://dotnetfiddle.net/)
|
|||
- [Palindrome](src/Strings/palindrome.cs)
|
||||
- [Trie](src/Strings/trie.cs)
|
||||
- [Character Limit](src/Strings/character-limit.cs)
|
||||
- [Reverse Words in String](src/Strings/reverse-words-in-string.cs)
|
||||
|
||||
## Search
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
|
||||
//Reverse the order of the words in a given string
|
||||
//Example: "Hello World" becomes "World Hello"
|
||||
|
||||
//Time Complexity: O(n)
|
||||
namespace Algorithms.Strings
|
||||
{
|
||||
public class ReverseWordsInString
|
||||
|
@ -15,6 +13,8 @@ namespace Algorithms.Strings
|
|||
Console.WriteLine(ReverseWords(originalString));
|
||||
}
|
||||
|
||||
//Reverse the order of the words in a given string
|
||||
//Example: "Hello World" becomes "World Hello"
|
||||
public static string ReverseWords(string input)
|
||||
{
|
||||
string[] words = input.Split(' ');
|
||||
|
|
Loading…
Reference in New Issue