Similar Pair, Graph algorithm problem A pair of nodes,(a,b) , is a similar pair if both of the following conditions are true: Node a is...
Sum vs XOR, Bit manipulation problem Given an integer, n, find each x such that: 0<=x <=n n+x = n^ x where ^ denotes the bitwise...
Breaking the Records, Algorithm problem Maria plays n games of college basketball in a season. Because she wants to go pro, she tracks her...
Between Two Sets, Algorithm problem Consider two sets of positive integers, A= {a0,a1…an-1} andA= {b0,b1…bn-1} . We say that a positive integer, , is between...
Kangaroo, Algorithm Problem There are two kangaroos on an x-axis ready to jump in the positive direction (i.e, toward positive infinity). The...
Grading Students, Algorithm Part-2 HackerLand University has the following grading policy: Every student receives a in the inclusive range from to . Any...
Apple and Orange, Algorithm Sam’s house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram...
Grading Students, Algorithm HackerLand University has the following grading policy: Every student receives a in the inclusive range from to . Any...
Birthday Cake Candles, Algorithm Colleen is turning years old! She has candles of various heights on her cake, and candle has height ....
Time Conversion, Algorithm Given a time in -hour AM/PM format, convert it to military (-hour) time. Note: Midnight is on a -hour...
Mini-Max Sum, Algorithm Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of...
Staircase, Algorithm Consider a staircase of size : # ## ### #### Observe that its base and height are both equal...
Plus Minus, Algorithm Given an array of integers, calculate which fraction of its elements are positive, which fraction of its elements are...
Diagonal Difference, Algorithm Given a square matrix of size , calculate the absolute difference between the sums of its diagonals. Input Format...
A Very Big Sum, Algorithm You are given an array of integers of size . You need to print the sum of the elements...
Compare the Triplets, Algorithm Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a...
Simple Array Sum, Algorithm Given an array of integers, can you find the sum of its elements? Input Format The first line contains...
Solve Me First, Algorithm Welcome to HackerRank! The purpose of this challenge is to familiarize you with reading input from stdin (the standard...
Insertion Sort with PHP – Part 2 In Insertion Sort Part 1, you sorted one element into an array. Using the same approach repeatedly, can you...
Insertion Sort with PHP – Part 1 Sorting One common task for computers is to sort data. For example, people might want to see all their...