Time Conversion Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock. Input Format A single string containing a time in 12-hour clock format (i.e.: hh:mm:ssAM or hh:mm:ssPM), where 01

Angry Professor Hackerrank A Discrete Mathematics professor has a class of N students. Frustrated with their lack of discipline, he decides to cancel class if fewer than K students are present when class starts. Given the arrival time of each student, determine if the class is canceled. Input Format The first line of input contains T, the number of test cases. Each test case consists of two lines. The first line has two space-separated integers, N(students in the class) and …

Designer PDF Viewer When you select a contiguous block of text in a PDF viewer, the selection is highlighted with a blue rectangle. In a new kind of PDF viewer, the selection of each word is independent of the other words; this means that each rectangular selection area forms independently around each highlighted word. For example: Designer PDF Viewer In this type of PDF viewer, the width of the rectangular selection area is equal to the number of letters in …

Jumping on the Clouds Hackerrank Emma is playing a new mobile game involving n clouds numbered from 0 to n-1. A player initially starts out on cloud c0, and they must jump to cloud cn-1. In each step, she can jump from any cloud i to cloud i+1 or cloud i+2. There are two types of clouds, ordinary clouds and thunderclouds. The game ends if Emma jumps onto a thundercloud, but if she reaches the last cloud (i.e., cn-1), she …

In computer science, tree traversal (also known as tree search) is a form of graph traversal and refers to the process of visiting (checking and/or updating) each node in a tree data structure, exactly once.Here we are talking about Pre-order tree traversal, and we will also learn a problem of hackerrank related to it.

Minimum Distances Hackerrank Consider an array of integers, A=[a0,a1,….,an-1]. The distance between two indices, i and j, is denoted by di,j=|i-j|. Given A, find the minimum di,j such that ai=aj and i!=j. In other words, find the minimum distance between any pair of equal elements in the array. If no such value exists, print -1. Note: |a| denotes the absolute value of a. Input Format The first line contains an integer, n, denoting the size of array A. The second …

Queue using Two Stacks Hackerrank A queue is an abstract data type that maintains the order in which elements were added to it, allowing the oldest elements to be removed from the front and new elements to be added to the rear. This is called a First-In-First-Out (FIFO) data structure because the first element added to the queue (i.e., the one that has been waiting the longest) is always the first one to be removed. A basic queue has the …