From the course: Nail Your C# Interview

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Normalize string input

Normalize string input - C# Tutorial

From the course: Nail Your C# Interview

Normalize string input

- [Instructor] Before processing a string for a technical interview, it can be helpful to normalize it to a common form in order to make your algorithm more efficient. Let's say you're searching for a particular letter within a string. You could search for that letter once in the lowercase form and once in the uppercase form. This means you would have to run two different searches to find out if the letter exists. Now, another way to go about this is to convert the string to all lower case. With this approach, you could search for the letter in the lower case form and only have to search once for one form of the letter. With two forms, you're still iterating through the string twice, but if the number of different forms the letter can appear as increases, your algorithm becomes less and less efficient. If you normalize it, it makes your code less complex. You search for one form of the data instead of multiple. This is…

Contents