Skip to content

Commit b01ce4e

Browse files
committed
Simplified a null-values check.
1 parent b43b25d commit b01ce4e

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

Algorithms/Strings/Permutations.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,9 @@ public static HashSet<string> Compute(string Source)
6060
/// </summary>
6161
public static bool IsAnargram(string Source, string Other)
6262
{
63-
bool nullCheck = false;
6463
int sourceCharSum = 0, otherCharSum = 0;
65-
bool isSourceNull = string.IsNullOrEmpty (Source);
66-
bool isOtherNull = string.IsNullOrEmpty (Other);
6764

68-
// Null values check
69-
nullCheck |= (isSourceNull && isOtherNull) || (isSourceNull && !isOtherNull) || (!isSourceNull && isOtherNull);
70-
71-
if (nullCheck == true)
65+
if (string.IsNullOrEmpty (Source) || string.IsNullOrEmpty (Other))
7266
return false;
7367
else if (Source.Length != Other.Length)
7468
return false;

0 commit comments

Comments
 (0)