Staircase

Consider a staircase of size n = 4:

1
2
3
4
   #
##
###
####

Observe that its base and height are both equal to n, and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces.

Write a program that prints a staircase of size n.


Plus Minus

Given an array of integers, calculate the fractions of its elements that are positive, negative, and are zeros. Print the decimal value of each fraction on a new line.


Diagonal Difference

Given a square matrix, calculate the absolute difference between the sums of its diagonals.

For example, the square matrix is shown below:

1
2
3
1 2 3
4 5 6
9 8 9

The left-to-right diagonal = 1 + 5 + 9 = 15. The right to left diagonal = 3 + 5 + 9 = 17. Their absolute difference is |15 - 17| = 2.


A Very Big Sum

Calculate and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large.


Compare the Triplets

Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a scale from 1 to 100 for three categories: problem clarity, originality, and difficulty.

We define the rating for Alice’s challenge to be the triplet a = (a[0], a[1], a[2]), and the rating for Bob’s challenge to be the triplet b = (b[0], b[1], b[2]).

Your task is to find their comparison points by comparing a[0] with b[0], a[1] with b[1], and a[2] with b[2].


Simple Array Sum

Given an array of integers, find the sum of its elements.

For example, if the array ar = [1, 2 ,3], 1 + 2 + 3 = 6, so return 6.


Solve Me First

Complete the function solveMeFirst to compute the sum of two integers.


Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×