img

Software Development Blog

Print the Elements of a Linked List. HackerRank Exercise

Print the Elements of a Linked List. HackerRank Exercise

This exercise is a part of my Linked List topic. If you’re new to linked lists, this is a great exercise for learning about them. Given a pointer to the head node of a linked list, print its elements in order, one element per line. If the head pointer is null (indicating the list is empty), don’t print […]

READ MORE

Climbing the Leaderboard – Medium HackerRank Exercise

Climbing the Leaderboard –  Medium HackerRank Exercise

Alice is playing an arcade game and wants to climb to the top of the leaderboard and wants to track her ranking. The game uses Dense Ranking, so its leaderboard works like this:  The player with the highest score is ranked number 1 on the leaderboard.  Players who have equal scores receive the same ranking number, and the […]

READ MORE

Picking Numbers HackerRank Exercise

Picking Numbers HackerRank Exercise

Given an array of integers, find and print the maximum number of integers you can select from the array such that the absolute difference between any two of the chosen integers is less than or equal to 1. For example, if your array is [1, 1, 2, 2, 4, 4, 5, 5, 5], you can create two […]

READ MORE

Magic Square HackerRank Exercise

Magic Square HackerRank Exercise

Problem Defined a magic square n x n to be a matrix of distinct positive integers from 1 to n^2 where the sum of any row, column, or diagonal of length n is always equal to the same number: the magic constant. The given 3 x 3 a matrix s of integers in the inclusive range [1, 9]. The […]

READ MORE