Posts

Angry Professor - HackerRank.

Image
A Discrete Mathematics professor has a class of students. Frustrated with their lack of discipline, he decides to cancel class if fewer than some number of students are present when class starts. Arrival times go from on time ( ) to arrived late ( ). Given the arrival time of each student and a threshhold number of attendees, determine if the class is canceled. Input Format The first line of input contains  , the number of test cases.

Breaking the Records - HackerRank.

Image
Maria plays college basketball and wants to go pro. Each season she maintains a record of her play. She tabulates the number of times she breaks her season record for  most points  and  least points  in a game. Points scored in the first game establish her record for the season, and she begins counting from there. For example, assume her scores for the season are represented in the array  . Scores are in the same order as the games played. She would tabulate her results as follows:

Kangaroo - HackerRank.

Image
You are choreographing a circus show with various animals. For one act, you are given two kangaroos on a number line ready to jump in the positive direction (i.e, toward positive infinity). The first kangaroo starts at location   and moves at a rate of   meters per jump. The second kangaroo starts at location   and moves at a rate of   meters per jump. You have to figure out a way to get both kangaroos at the same location at the same time as part of the show. If it is possible, return  YES , otherwise return  NO .

Apple and Orange - HackerRank.

Image
Sam's house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram below, the red region denotes his house, where   is the start point, and   is the endpoint. The apple tree is to the left of his house, and the orange tree is to its right. You can assume the trees are located on a single point, where the apple tree is at point  , and the orange tree is at point  .

Compare the Triplets - HackerRank.

Image
Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a scale from   to   for three categories:  problem clarity ,  originality , and  difficulty . We define the rating for Alice's challenge to be the triplet  , and the rating for Bob's challenge to be the triplet  . Your task is to find their  comparison points  by comparing   with  ,   with  , and   with  . If  , then Alice is awarded   point. If  , then Bob is awarded   point. If  , then neither person receives a point. Comparison points is the total points a person earned. Given   and  , determine their respective comparison points.

Birthday Cake Candles - HackerRank.

Image
You are in charge of the cake for your niece's birthday and have decided the cake will have one candle for each year of her total age. When she blows out the candles, she’ll only be able to blow out the tallest ones. Your task is to find out how many candles she can successfully blow out. For example, if your niece is turning   years old, and the cake will have   candles of height  ,  ,  ,  , she will be able to blow out   candles successfully, since the tallest candles are of height   and there are   such candles. Function Description Complete the function  birthdayCakeCandles  in the editor below. It must return an integer representing the number of candles she can blow out.