예제 #1
0
        public void FindMinTest(int[] input, string exptedOpt)
        {
            var result = Leetcode.FindMin(input);
            var output = string.Join(",", result);

            Assert.AreEqual(exptedOpt, output);
        }
예제 #2
0
        public void MaxAreaOfRectInBinarySearchTest()
        {
            //int[][] input = new int[1][];
            //   int result = 0;
            var input  = new int[][] { new int[] { 0, 1, 1, 0 }, new int[] { 1, 1, 1, 1 }, new int[] { 1, 1, 1, 1 }, new int[] { 1, 1, 0, 0 } };
            var result = Leetcode.MaxAreaOfRectInBinarySearch(input);

            Assert.AreEqual(8, result);

            input  = new int[][] { new int[] { 0, 1 }, new int[] { 1, 0 } };
            result = Leetcode.MaxAreaOfRectInBinarySearch(input);
            Assert.AreEqual(1, result);

            input  = new int[][] { new int[] { 0, 1 } };
            result = Leetcode.MaxAreaOfRectInBinarySearch(input);
            Assert.AreEqual(1, result);

            input  = new int[][] { new int[] { 0, 1, 1, 0 }, new int[] { 0, 1, 1, 1 }, new int[] { 1, 1, 1, 1 }, new int[] { 1, 1, 0, 0 } };
            result = Leetcode.MaxAreaOfRectInBinarySearch(input);
            Assert.AreEqual(6, result);

            input  = new int[][] { new int[] { 0, 1, 1, 0 }, new int[] { 1, 1, 1, 1 }, new int[] { 1, 1, 1, 0 }, new int[] { 1, 1, 0, 0 } };
            result = Leetcode.MaxAreaOfRectInBinarySearch(input);
            Assert.AreEqual(6, result);
        }
예제 #3
0
        public void NextGreaterElementsTest(int[] input, string exptedOpt)
        {
            var result = Leetcode.NextGreaterElements(input);
            var output = string.Join(",", result);

            Assert.AreEqual(exptedOpt, output);
        }
예제 #4
0
        public void CountSmallerTest(int[] input, string exptedOpt)
        {
            var result = Leetcode.CountSmaller(input);
            var output = string.Join(",", result);

            Assert.AreEqual(exptedOpt, output);
        }
예제 #5
0
        public void StockSpannerTest(int[] input, string exptedOpt)
        {
            var result = Leetcode.StockSpanner(input);
            var output = string.Join(", ", result);

            Assert.AreEqual(exptedOpt, output);
        }
예제 #6
0
        public void ProductExceptSelfTest(int[] input, string exptedOpt)
        {
            var result = Leetcode.ProductExceptSelf(input);
            var output = string.Join(",", result);

            Assert.AreEqual(exptedOpt, output);
        }
예제 #7
0
        public void LargestRectangleAreaTest(int[] input, string exptedOpt)
        {
            var result = Leetcode.LargestRectangleArea(input);
            var output = string.Join(", ", result);

            Assert.AreEqual(exptedOpt, output);
        }
예제 #8
0
        public void SearchRangeTest(int[] input, int target, string exptedOpt)
        {
            var output = Leetcode.SearchRange(input, target);

            var result = string.Join(",", output);

            Assert.AreEqual(exptedOpt, result);
        }
예제 #9
0
        public void MaximalRectangleTest()
        {
            var input  = new char[][] { new char[] { '0', '1' }, new char[] { '1', '0' } };
            var result = Leetcode.MaximalRectangle(input);

            Assert.AreEqual(1, result);
            input  = new char[][] { new char[] { '1', '0', '1', '0', '0' }, new char[] { '1', '0', '1', '1', '1' }, new char[] { '1', '1', '1', '1', '1' }, new char[] { '1', '0', '0', '1', '0' } };
            result = Leetcode.MaximalRectangle(input);
            Assert.AreEqual(6, result);
        }
예제 #10
0
        public void KSmallestPairsTest(int[] input1, int[] input2, int target, string exptedOpt)
        {
            var    output = Leetcode.KSmallestPairs(input1, input2, target);
            string result = "";

            for (int i = 0; i < output.Count; i++)
            {
                result += "[";
                result += string.Join(",", output[i]);
                result += "],";
            }
            Assert.AreEqual(exptedOpt, result);
        }
예제 #11
0
        public void CheckInclusionTest(string input, string input2, bool exptedOpt)
        {
            var result = Leetcode.CheckInclusion(input, input2);

            Assert.AreEqual(exptedOpt, result);
        }
 public Leetcode UpdateAndModify(int id, Leetcode body)
 {
     throw new System.NotImplementedException();
 }
예제 #13
0
        //Number of each words in a sentence.
        static void Main(string[] args)
        {
            var s = 3 % 4;

            //Timemanagement();
            string    str = "<?xml version=\"1.0\" encoding=\"utf - 8\" ?> <root id=\"1\">   < subElement id = \"1\" >      < subSubElement id = \"1\" /> < subSubElement id = \"2\" /></ subElement >< subElement id = \"2\" /> < subElement id = \"3\" />  </ root >";
            XmlEditor xm  = new XmlEditor();
            // xm.ReplaceNodeName(str, "subElement","child");


            StringMap <string> hdt = new StringMap <string>();

            hdt.AddElement("userName", "ishoo");
            hdt.AddElement("password", "1234");
            hdt.AddElement("email", "ishooagarwal");
            hdt.RemoveElement("password");
            hdt.RemoveElement("password");
            hdt.AddElement("password", "1234");
            hdt.AddElement("password", "1234");



            #region MyCodeSchool

            MyCodeSchool.MyLinkedListOperation();
            MyCodeSchool.ListArrayOperations();

            #endregion

            #region GeeksForGeeks

            var inputLongestLCS1 = "stone";
            var inputLongestLCS2 = "longest";
            var outputLongestLCS = GeeksForGeeks.LongestLCS(inputLongestLCS1, inputLongestLCS2);

            var inputUnionOfTwoArray1 = new int[] { 5, -4, -1, 2, -3, 4, 5, 6, -7, 8, 9 };
            var inputUnionOfTwoArray2 = new int[] { 21, 54, -79 };
            var outputUnionOfTwoArray = GeeksForGeeks.UnionOfTwoArray(inputUnionOfTwoArray1, inputUnionOfTwoArray2);
            Console.WriteLine(string.Join(",", outputUnionOfTwoArray));

            var inputGetMinAndMax = new int[] { 1, 345, 234, 21, 56789 };
            int min = int.MaxValue;
            int max = int.MinValue;
            GeeksForGeeks.GetMinAndMax(inputGetMinAndMax, out min, out max);
            Console.WriteLine($"{min} {max}");

            //var inputInsertionSort = new int[] { 5,-4,-1, 2, -3, 4, 5, 6, -7, 8, 9 };
            var inputInsertionSort = new int[] { -2, 1, -3, 4, -1, 2, 1, -5, 4 };
            GeeksForGeeks.InsertionSort(inputInsertionSort);

            var inputRearrangePositiveAndNegativeNumbers = new int[] { -4, -1, 2, -3, 4, 5, 6, -7, 8, 9 };
            //var inputRearrangePositiveAndNegativeNumbers = new int[] { 2, 3, 5, 7, 0, 40, -35, 54, 0, 0, 1 };
            GeeksForGeeks.RearrangePositiveAndNegativeNumbers(inputRearrangePositiveAndNegativeNumbers);

            var inputRearrangeArray = new int[] { 2, 3, 5, 7, 0, 40, 35, 54, 0, 0, 1, 5, 6, 2, 3, 5, 7, 11, 13, 17, 19, 5, 6, 2, 3, 5, 7, 11, 13, 17, 19, 5, 6, 2, 3, 5, 7, 11, 13, 17, 19 };
            // var inputRearrangeArray = new int[] { 5,6,2, 3, 5, 7, 0, 13, 17, 19 };
            var outputRearrangeArrayReplaceAproach = GeeksForGeeks.RearrangeArrayReplaceAproach(inputRearrangeArray);
            Console.WriteLine(string.Join(",", outputRearrangeArrayReplaceAproach));
            var outputRearrangeArray = GeeksForGeeks.RearrangeArray(inputRearrangeArray);
            Console.WriteLine(string.Join(",", outputRearrangeArray));

            var inputLeftRoatate  = new int[] { 2, 3, 5, 7, 11, 13, 17, 19 };
            var outputLeftRoatate = GeeksForGeeks.LeftRoatate(inputLeftRoatate, 2);
            var outputRightRotate = GeeksForGeeks.RightRotate(inputLeftRoatate, 2);

            var outLeftRotateReverseAlgo = GeeksForGeeks.LeftRotateByReverse(inputLeftRoatate, 2);
            #endregion

            #region CodingBlock
            var subArray = new int[] { 2, 3, 5, 7, 11, 13, 17, 19 };
            CodingBlock.NumOfElementsDivisibleByPrimeNum(20, subArray);
            #endregion

            #region Leetcode

            var inputmaxProduct  = new int[] { -1, -2, -5 };
            var outputmaxProduct = Leetcode.MaxProduct(inputmaxProduct);

            var outputDecodeString = Leetcode.DecodeString("3[a2[c]]");


            //var inputThreeSumAgain = new int[] { -1, 0, 1, 2, -1, -4, 1 };
            var inputThreeSumAgain  = new int[] { 0, 0, 0 };
            var outputThreeSumAgain = Leetcode.ThreeSumAgain(inputThreeSumAgain);

            var inputLengthOfLIS  = new int[] { 1, 3, 2, 4, 5, 7, 1 };
            var outputLengthOfLIS = Leetcode.LengthOfLIS(inputLengthOfLIS);

            var inputNextPermutation = new int[] { 1, 3, 2 };
            Leetcode.NextPermutation(inputNextPermutation);

            var inputMerge = new int[][]
            {
                new int[] { 1, 3 },
                new int[] { 2, 6 },
                new int[] { 8, 10 },
                new int[] { 15, 18 },
                new int[] { 2, 7 },
            };
            var outputMerge = Leetcode.Merge(inputMerge);

            var inputkadanaAlgorith = new int[] { 1, -1, 3, -5, 5, 2, -1, 7 };
            //var inputkadanaAlgorith = new int[] { -1, -2, -3, -4, -5 }; //-1
            var outPutkadanaAlgorith = Leetcode.kadanaAlgorith(inputkadanaAlgorith);

            var inputMergeArray1 = new int[] { 0, 2, 6, 8, 9 };
            var inputMergeArray2 = new int[] { 1, 3, 5, 7 };
            Leetcode.Merge(inputMergeArray1, 5, inputMergeArray2, 4);


            var inputMergeTwoSortedArray1 = new int[] { 0, 2, 6, 8, 9 };
            var inputMergeTwoSortedArray2 = new int[] { 1, 3, 5, 7 };
            var OutputMergeTwoSortedArray = Leetcode.mergeTwoSortedArray(inputMergeTwoSortedArray2, inputMergeTwoSortedArray1);

            //var inputminJumps = new int[] {1, 4, 3, 2, 6, 7 };
            var inputminJumps  = new int[] { 1, 3, 5, 8, 9, 2, 6, 7, 6, 8, 9 };
            var outputminJumps = Leetcode.minJumps(inputminJumps);

            var inputgetMinDiff  = new int[] { 1, 2, 3, 4, 5, 6, 7 };
            var outoutgetMinDiff = Leetcode.getMinDiff(inputgetMinDiff, 2);

            var inputMaxSubArray  = new int[] { -2, 1, -3, 4, -1, 2, 1, -5, 4 };
            var outputMaxSubArray = Leetcode.MaxSubArray(inputMaxSubArray);

            var inputFindKthLargest  = new int[] { 2, 0, 2, 1, 1, 0 };
            var outputFindKthLargest = Leetcode.FindKthLargest(inputFindKthLargest, 2);

            var inputNumberOfArithmeticSlices = new int[] { 2, 4, 6, 7, 8, 10 };
            Leetcode.NumberOfArithmeticSlices(inputNumberOfArithmeticSlices);

            var inputMinSetSize = new int[] { 3, 3, 3, 3, 5, 5, 5, 2, 2, 7 };
            Leetcode.MinSetSize(inputMinSetSize);

            #region
            //var inputTrap = new int[] { 0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1 };//6
            //var inputTrap = new int[] { 4, 2, 0, 3, 2, 5, 12, 4, 15 };//17
            var inputTrap = new int[] { 2, 0, 2 }; //2
            Leetcode.Trap(inputTrap);
            var inputNumSubmatrixSumTarget = new int[][] { new int[] { 0, 1, 0 },
                                                           #endregion

                                                           new int[] { 1, 1, 1 },
                                                           new int[] { 0, 1, 0 } };
            Leetcode.NumSubmatrixSumTarget(inputNumSubmatrixSumTarget, 0);
            Leetcode.RemoveElement(new int[] { 3, 2, 2, 3 }, 3);
            Leetcode.LetterCombinations("23");

            // var input = new int[] { -1, 0, 1, 2, -1, -4 };
            //output=
            var input = new int[] { 0, 0, 0, 0 };
            Leetcode.ThreeSum(input);

            #endregion

            #region LinQ
            LinqClass.Querylinq();
            LinqClass.concurrTask();
            string sentence = "hr id the ys the id";
            var    wordList = sentence?.Split(' ');
            Dictionary <string, int> tempWordList = new Dictionary <string, int>();
            int i = 1;
            foreach (var word in wordList)
            {
                if (tempWordList.ContainsKey(word))
                {
                    i = tempWordList[word];
                    i++;
                    tempWordList[word] = i;
                }
                else
                {
                    tempWordList.Add(word, 1);
                }
            }
            foreach (var item in tempWordList)
            {
                Console.WriteLine(item.Key + ":" + item.Value.ToString());
            }
            #endregion


            Console.ReadLine();
        }
예제 #14
0
 public IActionResult Create([FromBody] Leetcode body)
 {
     _leetcodeManagerService.Create(body);
     return(Json("Create leetcode"));
 }
예제 #15
0
 public IActionResult UpdateAndReplace(int id, [FromBody] Leetcode body)
 {
     return(Json("UpdateAndReplace leetcode"));
 }
 public Leetcode Create(Leetcode body)
 {
     throw new System.NotImplementedException();
 }
예제 #17
0
        public void LengthOfLISTest(int[] input1, int exptedOpt)
        {
            var result = Leetcode.LengthOfLIS(input1);

            Assert.AreEqual(exptedOpt, result);
        }
예제 #18
0
        public void LongestMountainTest(int[] input, int exptedOpt)
        {
            var result = Leetcode.LongestMountain(input);

            Assert.AreEqual(exptedOpt, result);
        }
예제 #19
0
        public void LengthOfLongestSubstringTest(string input, int exptedOpt)
        {
            var result = Leetcode.LengthOfLongestSubstring(input);

            Assert.AreEqual(exptedOpt, result);
        }
예제 #20
0
        public void CharFrequencyTest(string input, bool exptedOpt)
        {
            var dict = Leetcode.CharFrequency(input);

            Assert.NotNull(dict);
        }
예제 #21
0
        public void DecodeStringTest(string input, string exptedOpt)
        {
            var output = Leetcode.DecodeString(input);

            Assert.AreEqual(exptedOpt, output);
        }
예제 #22
0
        public void RainWaterTrapTest(int[] input, int exptedOpt)
        {
            var result = Leetcode.RainWaterTrap(input);

            Assert.AreEqual(exptedOpt, result);
        }
예제 #23
0
        public void MinWindowTest(string input, string input2, string exptedOpt)
        {
            var result = Leetcode.MinWindow(input, input2);

            Assert.AreEqual(exptedOpt, result);
        }
예제 #24
0
        public void maxProductTest(int[] input1, int exptedOpt)
        {
            var result = Leetcode.MaxProduct(input1);

            Assert.AreEqual(exptedOpt, result);
        }
예제 #25
0
        public void LargestSumAfterKNegationsTest(int[] input, int k, int exptedOpt)
        {
            var result = Leetcode.LargestSumAfterKNegations(input, k);

            Assert.AreEqual(exptedOpt, result);
        }
예제 #26
0
        public void CountSubstringsTest(string input, int exptedOpt)
        {
            var result = Leetcode.CountSubstrings(input);

            Assert.AreEqual(exptedOpt, result);
        }
예제 #27
0
        static void Main(string[] args)
        {
            string test = "fdasfsdafe";//"the sky is blue";

            //Console.WriteLine(ReverseWords(test));
            //Console.ReadKey();
            //Amazon oa = new Amazon();
            //int[][] points = new int[][]{new int[]{3,3},new int[]{5,-1},new int[]{-2,4}};
            //int[][] result=oa.KClosest(points, 2);

            int[] arr = { 7, 10, 4, 3, 20, 15 };
            //int result = oa.QuickSelect(arr, 0, arr.Length - 1, 3);
            //Write(result);
            //foreach (int[] r in result)
            //{
            //    Write(r);
            //    Console.WriteLine();
            //}
            //Console.ReadKey();
            #region CH2
            int[]   arrNoDuplicate             = { 2, 4, 1, 7, 5, 9, 3 };
            int[]   arrDuplicate               = { 2, 4, 5, 31, 7, 62, 5, 7, 29, 3 };
            int[]   arrSortedNoDuplicate       = { 2, 4, 6, 12, 15, 18, 22, 31, 43 };
            int[]   arrSortedDuplicate         = { 2, 4, 6, 12, 12, 12, 15, 18, 18, 22, 22, 31, 43 };
            int[]   arrSortedNoDuplicateRotate = { 2, 4, 6, 12, 15, 18, 22, 31, 43 };
            int[]   rotateArr = { 5, 6, 7, 9, 15, 1, 2, 4 };
            int[][] matrixSortedNoDuplicate = { new int[] { 1, 3, 5, 7, 9 }, new int[] { 10, 12, 14, 16, 18 }, new int[] { 21, 23, 25, 27, 29 }, new int[] { 30, 32, 34, 36, 38 } };
            Ch2     ch2 = new Ch2();

            //Find K's closest element
            //int[] test = { 1, 10, 15, 25, 35, 45, 50, 59 };
            //Write(ch2.kClosestNumbers(test, 30, 7));
            //search range
            //Write(ch2.SearchRange(arrSortedDuplicate, 12));

            //Get Insert postion
            //Write(ch2.GetInsertPosition(arrSortedNoDuplicate, 12));

            //Search in matrix
            // Write(ch2.Search2DMatrixV2(matrixSortedNoDuplicate, 5));

            //Find Peak
            //Write(ch2.FindPeak(arrNoDuplicate));
            //Console.ReadKey();

            //Find Min in Rotate
            //Write(ch2.FindMinInRotate(rotateArr));
            //Console.ReadKey();

            //Find target in Rotate
            //Write(ch2.SearchInRotate(arrSortedNoDuplicateRotate,18));
            // Console.ReadKey();

            //Remove DuplicateII
            //Write(ch2.RemoveDuplicatedII(arrSortedDuplicate));
            #endregion

            #region CH3

            #region init
            TreeNode one    = new TreeNode(1);
            TreeNode two    = new TreeNode(2);
            TreeNode three  = new TreeNode(3);
            TreeNode four   = new TreeNode(4);
            TreeNode five   = new TreeNode(5);
            TreeNode six    = new TreeNode(6);
            TreeNode seven  = new TreeNode(7);
            TreeNode eight  = new TreeNode(8);
            TreeNode night  = new TreeNode(9);
            TreeNode ten    = new TreeNode(10);
            TreeNode eleven = new TreeNode(11);
            TreeNode twelve = new TreeNode(12);

            five.left  = three;
            five.right = eight;

            three.left  = one;
            three.right = four;

            eight.left  = seven;
            eight.right = ten;

            seven.left = six;

            ten.left  = night;
            ten.right = eleven;


            #endregion
            Ch3 ch3 = new Ch3();
            //eleven.right = twelve;
            // Write(ch3.isBalanced(five));
            //Write(ch3.GetMaxPath(five));
            // Write(ch3.FindLCA(five, eight, ten).val);
            // Write(ch3.SearchRange(five,4,10));
            //NodeIterator ni = new NodeIterator(five);
            //while (ni.hasNext())
            //{
            //    Write(ni.next().val);
            //}
            // five = ch3.DeleteNode(five, 11);
            // Write(ten.right.val);

            // Console.ReadKey();
            #endregion

            #region CH4
            ListNode n1  = new ListNode(4);
            ListNode n2  = new ListNode(7);
            ListNode n3  = new ListNode(7);
            ListNode n4  = new ListNode(10);
            ListNode n5  = new ListNode(12);
            ListNode n6  = new ListNode(12);
            ListNode n7  = new ListNode(25);
            ListNode n8  = new ListNode(36);
            ListNode n9  = new ListNode(48);
            Ch4      ch4 = new Ch4();
            //ListNode sorted = n1;
            //{
            //    n1.next = n2;
            //    n2.next = n3;
            //    n3.next = n4;
            //    n4.next = n5;
            //    n5.next = n6;
            //    n6.next = n7;
            //    n7.next = n8;
            //    n8.next = n9;
            //}

            ListNode unSorted = n5;
            {
                n5.next = n7;
                n7.next = n4;
                n4.next = n8;
                n8.next = n2;
                n2.next = n3;
                n3.next = n9;
                n9.next = n1;
                n1.next = n6;
            }

            // Write(unSorted);
            // Write(ch4.Partition(unSorted,22));


            //
            #endregion
            //Console.WriteLine("GetEnvironmentVariables: ");
            //foreach (DictionaryEntry de in Environment.GetEnvironmentVariables())
            //    Console.WriteLine("  {0} = {1}", de.Key, de.Value);
            #region leetcode
            Leetcode lc = new Leetcode();

            /*
             * question 1
             */

            //int[] arr={3,2,4};
            //int[] result= lc.LeetCode1_TwoSum(arr, 6);
            /************************************************************************************/

            /*
             * question 2
             */
            ListNode node1 = new ListNode(1);
            ListNode node2 = new ListNode(2);
            ListNode node3 = new ListNode(3);
            ListNode node4 = new ListNode(4);
            ListNode node5 = new ListNode(5);
            ListNode node6 = new ListNode(6);
            ListNode node7 = new ListNode(7);
            ListNode node8 = new ListNode(8);
            ListNode node9 = new ListNode(9);

            node2.next = node4;
            node4.next = node3;
            node5.next = node6;
            node6.next = node1;
            //ListNode n = lc.AddTwoNumbers(node2, node5);
            /************************************************************************************/



            /*
             * Question 3
             */
            //int result = lc.LengthOfLongestSubstring(test);
            //Write(result);

            //Console.ReadKey();

            //int  i=lc.FirstUniqChar("leetcode");
            //StringBuilder sb = new StringBuilder();
            //sb.Append('a');
            //sb.Append('e');
            //sb.Append('i');
            //sb.Append('o');
            //sb.Append('u');
            //Console.Write(sb.ToString()[0]);
            //Write(lc.RepeatedSubstringPattern(str));
            //int[,] arr = new int[4, 2];
            //int width = arr.GetLength(0);
            //int height = arr.GetLength(1);

            //bounds
            //int upperBound0 = arr.GetUpperBound(0);
            //int lowerBound0 = arr.GetLowerBound(0);
            //int upperBound1 = arr.GetUpperBound(1);
            //int lowerBound1 = arr.GetLowerBound(1);

            //Console.WriteLine("upper bound 0: " + upperBound0);
            //Console.WriteLine("lower bound 0: " + lowerBound0);
            //Console.WriteLine("upper bound 1: " + upperBound1);
            //Console.WriteLine("lower bound 1: " + lowerBound1);

            Algrithms.QuickSort(arrNoDuplicate, 0, arrNoDuplicate.Length - 1);
            Write(arrNoDuplicate);

            //int t = 122; long r = 0;
            //for (int i = 0; i < 50; i++)
            //{
            //    r = 31 * r + t;
            //}
            //Console.Write(r);
            //    Console.ReadKey();

            #region 5
            /*5*/

            //string str = "caba";
            //string sub = lc.LongestPalindromeSubstring(str);

            #endregion

            #region 7
            //int ori=1534236469;
            //int result = lc.ReverseInteger(ori);
            //
            #endregion
            #endregion
            string s = "a";
            long   n = 1000000000000;
            //string str = Helper.GetRepeatString(s, n);
            //long result = (long)Helper.GetAs(str);
            //List<string> l = new List<string>{ "990","332","32" };
            //List<int> lookup = new List<int> { 3, 5, 4, 6, 2, 7, 9, 8, 0, 1 };
            //List<string> result = HackerRank.StrangeSort(l, lookup);
            // int[][] arr =new int[][] { new int[] { 3, 0, 8, 4 }, new int[] { 2, 4, 5, 7 }, new int[] { 9, 2, 6, 3 }, new int[] { 0, 3, 1, 0 } };
            // Leetcode lt = new Leetcode();
            //int result=  lt.MaxIncreaseKeepingSkyline(arr);

            //    Console.Write(result);
            Console.ReadKey();
        }