This exercise is a part of my Linked List topic. You’re given the pointer to the head node of a linked list and an integer to add to the list. Create a new node with the given integer, insert this node at the head of the linked list and return the new head node. The […]

This exercise is a part of my Linked List topic. You are given the pointer to the head node of a linked list and an integer to add to the list. Create a new node with the given integer. Insert this node at the tail of the linked list and return the head node of […]

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 […]

I started to learn a python programming language and the best way to learn some new language is a practice of course. I try to learn algorithms and data structures step by step on HackerRank. The goal of this post is a strong understanding of Linked List data structure and explanations of common Linked list […]

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 […]

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 […]

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 […]