| | | 1 | | // -------------------------------------------------------------------------------- |
| | | 2 | | // Copyright (C) 2026 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 | | namespace LeetCode.Algorithms.CheckIfStringsCanBeMadeEqualWithOperations1; |
| | | 13 | | |
| | | 14 | | /// <inheritdoc /> |
| | | 15 | | public sealed class CheckIfStringsCanBeMadeEqualWithOperationsPairMatching : |
| | | 16 | | ICheckIfStringsCanBeMadeEqualWithOperations1 |
| | | 17 | | { |
| | | 18 | | /// <summary> |
| | | 19 | | /// Time complexity - O(1) |
| | | 20 | | /// Space complexity - O(1) |
| | | 21 | | /// </summary> |
| | | 22 | | /// <param name="s1"></param> |
| | | 23 | | /// <param name="s2"></param> |
| | | 24 | | /// <returns></returns> |
| | | 25 | | public bool CanBeEqual(string s1, string s2) |
| | 12 | 26 | | { |
| | 12 | 27 | | return ((s1[0] == s2[0] && s1[2] == s2[2]) || (s1[0] == s2[2] && s1[2] == s2[0])) && |
| | 12 | 28 | | ((s1[1] == s2[1] && s1[3] == s2[3]) || (s1[1] == s2[3] && s1[3] == s2[1])); |
| | 12 | 29 | | } |
| | | 30 | | } |