コード例 #1
0
        public void MajorityElementTest()
        {
            MajorityElements majorityElements = new MajorityElements();

            int[] nums = new int[] { 3, 2, 3 };
            int   res  = majorityElements.MajorityElement(nums);

            Assert.IsTrue(res == 3);
        }
コード例 #2
0
 private static void TestBoyerMoore()
 {
     Console.WriteLine(5 == MajorityElements.BoyerMoore(new [] { 1, 3, 5, 5, 5, 5, 4, 1, 5 }));
 }