| | 1 | | // -------------------------------------------------------------------------------- |
| | 2 | | // Copyright (C) 2025 Eugene Eremeev (also known as Yevhenii Yeriemeieiv). |
| | 3 | | // All Rights Reserved. |
| | 4 | | // -------------------------------------------------------------------------------- |
| | 5 | | // This software is the confidential and proprietary information of Eugene Eremeev |
| | 6 | | // (also known as Yevhenii Yeriemeieiv) ("Confidential Information"). You shall not |
| | 7 | | // disclose such Confidential Information and shall use it only in accordance with |
| | 8 | | // the terms of the license agreement you entered into with Eugene Eremeev (also |
| | 9 | | // known as Yevhenii Yeriemeieiv). |
| | 10 | | // -------------------------------------------------------------------------------- |
| | 11 | |
|
| | 12 | | using System.Text; |
| | 13 | |
|
| | 14 | | namespace LeetCode.Algorithms.ToLowerCase; |
| | 15 | |
|
| | 16 | | /// <inheritdoc /> |
| | 17 | | public class ToLowerCaseStringBuilder : IToLowerCase |
| | 18 | | { |
| | 19 | | /// <summary> |
| | 20 | | /// Time complexity - O(n) |
| | 21 | | /// Space complexity - O(n) |
| | 22 | | /// </summary> |
| | 23 | | /// <param name="s"></param> |
| | 24 | | /// <returns></returns> |
| | 25 | | public string ToLowerCase(string s) |
| 3 | 26 | | { |
| 3 | 27 | | var resultStringBuilder = new StringBuilder(); |
| | 28 | |
|
| 39 | 29 | | foreach (var c in s) |
| 15 | 30 | | { |
| 15 | 31 | | resultStringBuilder.Append(char.ToLower(c)); |
| 15 | 32 | | } |
| | 33 | |
|
| 3 | 34 | | return resultStringBuilder.ToString(); |
| 3 | 35 | | } |
| | 36 | | } |