static void RunQueuesAndStacks() { var input = Console.ReadLine(); var coderInThirtyDays = new CoderInThirtyDays(); Console.WriteLine(coderInThirtyDays.IsPalindrome(input)); }
static void RunBinaryNumbers() { var number = Convert.ToInt32(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); Console.WriteLine(coderInThirtyDays.CountConsecutiveOnes(number)); }
static void RunLoops() { var number = Convert.ToInt32(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); coderInThirtyDays.PrintMultiplies(number); }
static void RunIntroToConditionalStatements() { var number = Convert.ToInt32(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); Console.WriteLine(coderInThirtyDays.CalculateWeirdness(number)); }
static void RunExceptionsStringToInteger() { var input = Console.ReadLine(); var coderInThirtyDays = new CoderInThirtyDays(); Object result = coderInThirtyDays.ConvertStringToInteger(input); Console.WriteLine(result); }
static void RunRecursion3() { var number = Convert.ToInt32(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); int result = coderInThirtyDays.CalculateFactorial(number); Console.WriteLine(result); }
static void RunArrays() { var arrayLength = Convert.ToInt32(Console.ReadLine()); int[] numberArray = Array.ConvertAll(Console.ReadLine().Split(' '), tempArray => Convert.ToInt32(tempArray)); var coderInThirtyDays = new CoderInThirtyDays(); Console.WriteLine(coderInThirtyDays.ReverseArray(numberArray)); }
static void RunOperators() { var mealCost = Convert.ToDouble(Console.ReadLine()); var tipPercent = Convert.ToInt32(Console.ReadLine()); var taxPercent = Convert.ToInt32(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); coderInThirtyDays.CalculateTotalCost(mealCost, tipPercent, taxPercent); }
static void RunRunningTimeAndComplexity() { var testsAmount = Int32.Parse(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); for (var i = 0; i < testsAmount; i++) { var number = Int32.Parse(Console.ReadLine()); Console.WriteLine(coderInThirtyDays.IsPrimeNumber(number)); } }
static void RunNestedLogic() { var returnedDateString = Console.ReadLine(); var expectedDateString = Console.ReadLine(); String[] returnedDate = returnedDateString.Split(' '); String[] expectedDate = expectedDateString.Split(' '); var coderInThirtyDays = new CoderInThirtyDays(); Console.WriteLine(coderInThirtyDays.CalculateFineForLibraryBook(Int32.Parse(returnedDate[0]), Int32.Parse(returnedDate[1]), Int32.Parse(returnedDate[2]), Int32.Parse(expectedDate[0]), Int32.Parse(expectedDate[1]), Int32.Parse(expectedDate[2]))); }
static void RunLinkedList() { Node head = null; var testsAmount = Int32.Parse(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); while (testsAmount-- > 0) { var data = Int32.Parse(Console.ReadLine()); head = coderInThirtyDays.InsertNodeToLinkedList(head, data); } coderInThirtyDays.DisplayLinkedList(head); }
static void RunBitwiseAND() { var testsAmount = Convert.ToInt32(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); for (var i = 0; i < testsAmount; i++) { string[] inputs = Console.ReadLine().Split(' '); var rightSetBorder = Convert.ToInt32(inputs[0]); var lessThanValue = Convert.ToInt32(inputs[1]); Console.WriteLine(coderInThirtyDays.FindMaxPossibleValueOfBitwiseOperation(rightSetBorder, lessThanValue)); } }
static void RunMoreLinkedLists() { Node head = null; var nodesAmount = Int32.Parse(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); while (nodesAmount-- > 0) { var data = Int32.Parse(Console.ReadLine()); head = coderInThirtyDays.InsertNodeToLinkedList(head, data); } head = coderInThirtyDays.RemoveDuplicatesInLinkedList(head); coderInThirtyDays.DisplayLinkedList(head); }
static void RunBinarySearchTrees() { TreeNode root = null; var nodesAmount = Int32.Parse(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); while (nodesAmount-- > 0) { var data = Int32.Parse(Console.ReadLine()); root = coderInThirtyDays.InsertIntoTree(root, data); } int height = coderInThirtyDays.GetTreeHeight(root); Console.WriteLine(height); }
static void RunLetsReview() { var testsAmount = Convert.ToInt32(Console.ReadLine()); var inputs = new List <string>(); for (var i = 0; i < testsAmount; i++) { var inputString = Console.ReadLine(); inputs.Add(inputString); } foreach (var reviewInput in inputs) { var coderInThirtyDays = new CoderInThirtyDays(); var resultString = coderInThirtyDays.RegroupStringByEvenAndOddCharacters(reviewInput); Console.WriteLine(resultString); } }
static void RunBSTLevelOrderTraversal() { TreeNode root = null; var nodesAmount = Int32.Parse(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); while (nodesAmount-- > 0) { var data = Int32.Parse(Console.ReadLine()); root = coderInThirtyDays.InsertIntoTree(root, data); } List <int> result = coderInThirtyDays.GetBreadthFirstAllNodesInTree(root); foreach (var item in result) { Console.Write($"{ item } "); } }
static void RunRegExPatternsAndIntroToDatabases() { var personsAmount = Convert.ToInt32(Console.ReadLine()); var coderInThirtyDays = new CoderInThirtyDays(); var personalDataList = new List <PersonalData>(); for (var i = 0; i < personsAmount; i++) { string[] inputs = Console.ReadLine().Split(' '); string firstName = inputs[0]; string emailID = inputs[1]; personalDataList.Add(new PersonalData(firstName, emailID)); } List <string> result = coderInThirtyDays.GetAlphabeticallyOrderedListOfFirstNamesForEveryUserWithAGmailAccount(personalDataList); foreach (var name in result) { Console.WriteLine(name); } }
static void RunGenerics() { var coderInThirtyDays = new CoderInThirtyDays(); var arrayLength = Convert.ToInt32(Console.ReadLine()); var intArray = new int[arrayLength]; for (var i = 0; i < arrayLength; i++) { intArray[i] = Convert.ToInt32(Console.ReadLine()); } arrayLength = Convert.ToInt32(Console.ReadLine()); var stringArray = new string[arrayLength]; for (var i = 0; i < arrayLength; i++) { stringArray[i] = Console.ReadLine(); } coderInThirtyDays.PrintArray <Int32>(intArray); coderInThirtyDays.PrintArray <String>(stringArray); }
static void RunDictionariesAndMaps() { var entriesLength = Convert.ToInt32(Console.ReadLine()); var input = new string[entriesLength]; for (var i = 0; i < entriesLength; i++) { input[i] = Console.ReadLine(); } var coderInThirtyDays = new CoderInThirtyDays(); Dictionary <string, string> phoneBook = coderInThirtyDays.GeneratePhoneBook(input); string name; var names = new List <string>(); while ((name = Console.ReadLine()) != null) { names.Add(name); } foreach (var nameElement in names) { string result = coderInThirtyDays.FindNumberInPhoneBook(phoneBook, nameElement); Console.WriteLine(result); } }