Utopian Tree
The Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. Each summer, its height increases by 1 meter. A Utopian Tree sapling with a height of 1 meter is planted at the onset of spring. How tall will the tree be after growth cycles? For example, if the number of growth cycles is n = 5, the calculations are as follows: Period Height 0 1 1 2 2 3 3 6 4 7 5 14 Function Description Co
View Solution →Angry Professor
A Discrete Mathematics professor has a class of students. Frustrated with their lack of discipline, the professor decides to cancel class if fewer than some number of students are present when class starts. Arrival times go from on time (arrivalTime < 0) to arrived late (arrivalTime > 0). Given the arrival time of each student and a threshhold number of attendees, determine if the class is cancelled. Example n = 5 k = 3 a = [-2, -1, 0, 1, 2] The first 3 students arrived on. The last
View Solution →Beautiful Days at the Movies
Lily likes to play games with integers. She has created a new game where she determines the difference between a number and its reverse. For instance, given the number 12, its reverse is 21. Their difference is 9. The number 120 reversed is 21, and their difference is 99. She decides to apply her game to decision making. She will look at a numbered range of days and will only go to a movie on a beautiful day. Given a range of numbered days, [i.....j] and a number k, determine the number of
View Solution →Viral Advertising
HackerLand Enterprise is adopting a new viral advertising strategy. When they launch a new product, they advertise it to exactly 5 people on social media. On the first day, half of those 5 people (i.e., floor(5/2) = 2 ) like the advertisement and each shares it with 3 of their friends. At the beginning of the second day, floor(5/2)*3 = 2*3 = 6 people receive the advertisement. Each day, floor(recipients/2) of the recipients like the advertisement and will share it with 3 friends on the fol
View Solution →Super Reduced String
Reduce a string of lowercase characters in range ascii[‘a’..’z’]by doing a series of operations. In each operation, select a pair of adjacent letters that match, and delete them. Delete as many characters as possible using this method and return the resulting string. If the final string is empty, return Empty String Function Description Complete the superReducedString function in the editor below. superReducedString has the following parameter(s): string s: a string to reduce R
View Solution →