Ejemplo n.º 1
0
        public void GetLoopStart2(
            CTCI.Ch_02_Linked_Lists.LinkedListNode <int> head,
            CTCI.Ch_02_Linked_Lists.LinkedListNode <int> expected)
        {
            var solution = new DetectLoop();

            var actual = solution.GetLoopStart2(head);

            Assert.Same(expected, actual);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // Array
            #region Find Duplicate Item and Count in Array
            //FindDuplicateInStringArray.FindDuplicateStringWithCount();
            //FindDuplicateInStringArray.FindDuplicateObjectByPropertyWithCount();
            //FindDuplicateIntAppearN.Test();
            //FindDuplicatesIntAppearTwice.Test();
            //FindMaxProductSubArray.Test();
            //Shuffle2nIntegers.Test();
            //FindPairOfSum.Test();
            //FindAllSubset.Test();
            //MergeTwoSortedArray.Test();
            //FindItemInNRotatedSortedArray.Test();
            //RotateArray.Test();
            //FindMinInRotatedSortedArray.Test();
            #endregion

            #region Common
            //Fibonacci.Test();
            //SumOfFirstNReciprocals.Test()
            //PowerOf2.Test();
            //FindNumberOf1InBinary.Test();
            //CountNumOf2s.Test();
            //CoinChange.Test();
            //ReverseInteger.Test();
            //IfPrime.Test();
            //CountNumOf1s.Test();
            //TowersOfHanoi.Test();
            //DigitalClock.LongRunTask();
            //Console.WriteLine($"Number of Primes from 1-13: {CountPrimes.solution(13)}");
            #endregion

            #region String
            //RemoveDuplicateCharInString.Test();
            //CheckAnagramString.Test();
            //MaxRecurringChar.Test();
            //FindLocationInEmptyArray.Test();
            //ValidPalindrome.Test();
            //StrStr.Test();
            //ReverseWords.Test();
            //LongestSubstringWithoutRepeating.Test();
            //LongestPalindromicSubstring.Test();
            #endregion

            #region Tree
            ///* Constructed binary tree is
            //EvaluationExpressionTree.Test();
            //LevelOrder.Test();
            //TraversalPostOrder.Test();
            //TraversalInOrder.Test();
            #endregion

            #region LinkedList
            //ReverseList.Test();
            //FindMiddleOfGivenList.Test();
            //PairwiseSwapEementsInList.Test();
            DetectLoop.Test();
            #endregion

            #region Matrix
            //Rotate90Matrix.Test();
            #endregion

            Console.Write("\n");
            Console.ReadKey();
        }