예제 #1
0
        static void Main(string[] args)
        {
            //Morse // CodeWars web interface supplied an API for this dictionary
            InitializeDictionary();


            string decodedString = MorseDecoder.Decoder(".... . -.--   .--- ..- -.. .");

            Console.WriteLine(decodedString);


            //Tribonacci
            int n = 22;

            double[] tribo  = new double[] { 0, 3, 16 };
            double[] result = Tribonacci(tribo, n);

            foreach (var item in result)
            {
                Console.WriteLine(item);
            }


            //ValidatePin
            //string[] testCases = new string[] { "1234-+", "1234\n", "573012    ", "120412", "0000" };

            bool resA = ValidatePin("1233-+");
            bool resB = ValidatePin("1234\n");
            bool resC = ValidatePin("573012   ");
            bool resD = ValidatePin("120412");
            bool resE = ValidatePin("0000");

            Console.WriteLine(resA);
            Console.WriteLine(resB);
            Console.WriteLine(resC);
            Console.WriteLine(resD);
            Console.WriteLine(resE);


            //Disemvowel

            string resultA = Disemvowel("This website is for losers LOL!");
            string resultB = Disemvowel("Your mother is a terrible weight watcher LOL!");

            Console.WriteLine(resultA);
            Console.WriteLine(resultB);



            //Exes and Ohs

            //(true, XO("xo"))
            //(true, XO("xxOo"))
            //(false, XO("xxxm"))
            //(false, XO("Oo"))
            //(false, XO("ooom"))
            var inputA = "xo";
            var inputB = "xXOo";
            var inputC = "xoomm";

            bool resultBoolA = XO(inputA);
            bool resultBoolB = XO(inputB);
            bool resultBoolC = XO(inputC);

            Console.WriteLine(resultBoolA);
            Console.WriteLine(resultBoolB);
            Console.WriteLine(resultBoolC);



            // Sum Of Numbers(from A to B)
            int sumA = -1;
            int sumB = -5;

            int sum = GetSum(sumA, sumB);

            Console.WriteLine(sum);



            //Square Every Digit
            int squareMe  = 9999;
            int squaredMe = SquareDigits(squareMe);

            Console.WriteLine(squaredMe);



            //DuplicateCount

            int duplicateCount = DuplicateCount("AaBbCc44a");

            Console.WriteLine("Expected: 4 Count: " + duplicateCount);



            //ListFilterer

            //var list = new List<object>() { 1, 2, "a", "b" };
            //var resultR = GetIntegersFromList(list);
            //foreach (var item in resultR)
            //{
            //    Console.WriteLine(item);
            //}



            //IQTest..
            Console.WriteLine(Test("2 4 7 8 10"));



            //Number of people on the bus
            List <int[]> peopleListInOut = new List <int[]> {
                new[] { 10, 0 }, new[] { 3, 5 }, new[] { 5, 8 }
            };

            int resultNumber = Number(peopleListInOut);

            Console.WriteLine(resultNumber);



            //WUBWUBWUBWUB

            string testAB = SongDecoder("WUBWUBABCWUB");
            string testAC = SongDecoder("RWUBWUBWUBLWUB");
            string testAD = SongDecoder("WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB");


            Console.WriteLine(testAB);
            Console.WriteLine(testAC);
            Console.WriteLine(testAD);



            //NEWWORDORDER

            string inOrder = Order("is2 Thi1s T4est 3a");

            Console.WriteLine(inOrder);



            //ArrayDiff

            int[] a = ArrayDiff(new int[] { 1, 2 }, new int[] { 1 });
            int[] b = ArrayDiff(new int[] { 1, 2, 2, 2, 2 }, new int[] { 1 });
            int[] c = ArrayDiff(new int[] { 1, 2, 2 }, new int[] { 2 });
            int[] d = ArrayDiff(new int[] { 1, 2, 2 }, new int[] { });
            int[] e = ArrayDiff(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15 }, new int[] { 1, 7, 7 });

            foreach (var item in b)
            {
                Console.WriteLine(item);
            }

            //Split String into pairs. if pairs are not even, even it out with "_"

            string[] resultSol = Solution("abcdedasdsdvsdfsfdada");
            foreach (var item in resultSol)
            {
                Console.WriteLine(item);
            }
        }
예제 #2
0
        public void CheckForOneWordPosTest()
        {
            string tes = ".... . .-.. .-.. ---";

            Assert.AreEqual(morseDecoder.Decoder(tes), "HELLO");
        }