Showing posts with label Algorithms. Show all posts
Showing posts with label Algorithms. Show all posts

Sunday, November 18, 2018

Birthday Cake Candles - Hacker Rank Solution

Birthday Cake Candles  - Hacker Rank Solution


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

Mini-Max Sum - Hacker Rank Solution

Mini-Max Sum - Hacker Rank Solution

Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum

Friday, April 15, 2016

Bit Manipulation Challenges - Hacker Rank Solution

There are NN integers in an array AA. All but one integer occur in pairs. Your task is to find the number that occurs only once.

Wednesday, March 23, 2016

Sherlock and The Beast - Hacker Rank Solution

Sherlock Holmes suspects his archenemy, Professor Moriarty, is once again plotting something diabolical. Sherlock's companion, Dr. Watson, suggests Moriarty may be responsible for MI6's recent issues with their supercomputer, The Beast.

Angry Professor - Hacker Rank Solution

A Discrete Mathematics professor has a class of NN students. Frustrated with their lack of discipline, he decides to cancel class if fewer than KK students are present when class starts.
Given the arrival time of each student, determine if the class is canceled.

Time Conversion - Hacker Rank Solution

Given a time in AM/PM format, convert it to military (2424-hour) time.

Thursday, February 4, 2016

Staircase - Hacker Rank Solution

Your teacher has given you the task of drawing a staircase structure. Being an expert programmer, you decided to make a program to draw it for you instead. Given the required height, can you print a staircase as shown in the example?

Plus Minus - Hacker Rank Solution

Given an array of integers, calculate which fraction of the elements are positive, negative, and zeroes, respectively. Print the decimal value of each fraction.
Input Format
The first line, N, is the size of the array.

Diagonal Difference - Hacker Rank Solution

Given a square matrix of size N×N, calculate the absolute difference between the sums of its diagonals.
Input Format
The first line contains a single integer, N. The next N lines denote the matrix's rows, with each line

A Very Big Sum - - Hacker Rank Solution

You are given an array of integers of size N. You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large.

Simple Array Sum - Hacker Rank Solution

You are given an array of integers of size N. Can you find the sum of the elements in the array?
Input
The first line of input consists of an integer N. The next line contains N space-separated integers representing the array elements.

Solve Me First - Hacker Rank Solution

Let's start simple. Can you complete the function solveMeFirst to return the sum of two integers passed as input parameters? You can pick your favorite programming language.

Thursday, January 14, 2016

Swap Nodes [Algo] - Hacker Rank Solution

A binary tree is a tree which is characterized by any one of the following properties:
  • It can be an empty (null).
  • It contains a root node and two subtrees, left subtree and right subtree. These subtrees are also binary tree.

Binary Search Tree : Lowest Common Ancestor - Hacker Rank Solution

You are given pointer to the root of the binary search tree and two values v1 and v2. You need to return the lowest common ancestor (LCA) of v1 and v2 in the binary search tree. You only need to complete the function.
Powered by Blogger.