We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ffa07a8 commit 94b4f75Copy full SHA for 94b4f75
Algorithms/Other/BoyerMooreMajorityVote.cs
@@ -13,13 +13,13 @@ public static class BoyerMooreMajorityVote
13
/// <returns>Majority element or null.</returns>
14
public static int? FindMajority(int[] nums)
15
{
16
- if (nums?.Length == 0)
+ if (nums == null || nums.Length == 0)
17
18
return null;
19
}
20
21
- var candidate = FindCandidate(nums!);
22
- return IsMajority(nums!, candidate) ? candidate : null;
+ var candidate = FindCandidate(nums);
+ return IsMajority(nums, candidate) ? candidate : null;
23
24
25
private static int FindCandidate(int[] nums)
0 commit comments