본문 바로가기

Day 29: Bitwise AND Task Given set . Find two integers, and (where ), from set such that the value of is the maximum possible and also less than a given integer, . In this case, represents the bitwise ANDoperator.Input FormatThe first line contains an integer, , the number of test cases. Each of the subsequent lines defines a test case as space-separated integers, and , respectively.ConstraintsOutput FormatFor each.. 더보기
Day 28: RegEx, Patterns, and Intro to Databases Task Consider a database table, Emails, which has the attributes First Name and Email ID. Given rows of data simulating the Emails table, print an alphabetically-ordered list of people whose email address ends in .Input FormatThe first line contains an integer, , total number of rows in the table. Each of the subsequent lines contains space-separated strings denoting a person's first name and em.. 더보기
Day 27: Testing Objective This challenge is very different from the others we've completed because it requires you to generate a valid test case for a problem instead of solving the problem. There is no input to read, you simply have to generate and print test values for the problem that satisfy both the problem's Input Format and the criteria laid out in the Tasksection. Check out the Tutorial tab for an instr.. 더보기
Day 26: Nested Logic Task Your local library needs your help! Given the expected and actual return dates for a library book, create a program that calculates the fine (if any). The fee structure is as follows:If the book is returned on or before the expected return date, no fine will be charged (i.e.: .If the book is returned after the expected return day but still within the same calendar month and year as the expe.. 더보기
Day 25: Running Time and Complexity Task A prime is a natural number greater than that has no positive divisors other than and itself. Given a number, , determine and print whether it's or .Note: If possible, try to come up with a primality algorithm, or see what sort of optimizations you come up with for an algorithm. Be sure to check out the Editorial after submitting your code!Input FormatThe first line contains an integer, , t.. 더보기
Day 24: More Linked Lists Task A Node class is provided for you in the editor. A Node object has an integer data field, , and a Node instance pointer, , pointing to another node (i.e.: the next node in a list).A removeDuplicates function is declared in your editor, which takes a pointer to the node of a linked list as a parameter. Complete removeDuplicates so that it deletes any duplicate nodes from the list and returns .. 더보기
Day 23: BST Level-Order Traversal Task A level-order traversal, also known as a breadth-first search, visits each level of a tree's nodes from left to right, top to bottom. You are given a pointer, , pointing to the root of a binary search tree. Complete the levelOrderfunction provided in your editor so that it prints the level-order traversal of the binary search tree.Hint: You'll find a queue helpful in completing this challen.. 더보기
Day 21: Generics Task Write a single generic function named printArray; this function must take an array of generic elements as a parameter (the exception to this is C++, which takes a vector). The locked Solution class in your editor tests your function.Note: You must use generics to solve this challenge. Do not write overloaded functions.Input FormatThe locked Solution class in your editor will pass different .. 더보기
Day 20: Sorting Consider the following version of Bubble Sort:for (int i = 0; i array[j + 1]) { int temp = array[j]; array[j] = array[j+1]; array[j+1] = temp; numberOfSwaps++; } } // If no elements were swapped during a traversal, array is sorted if (numberOfSwaps == 0) { break; } } return numberOfSwaps; } Integer getFirstElement() { return array[0]; } Integer getLastElement() { return array[array.length - 1]; .. 더보기
Day 19: Interfaces Task The AdvancedArithmetic interface and the method declaration for the abstract int divisorSum(int n) method are provided for you in the editor below. Write the Calculator class, which implements the AdvancedArithmeticinterface. The implementation for the divisorSum method must be public and take an integer parameter, , and return the sum of all its divisors.Note: Because we are writing multip.. 더보기