Overview In this article we will try to solve one of the problem from HackerRank called Electronic Shop. A person wants to determine the most expensive computer keyboard and USB drive that can be purchased with a give budget. Given price lists for keyboards and USB drives and a budget, find the cost to buyContinue reading “Electronic Shop (Hacker Rank)”

# Author Archives: Mohammad Meraj Zia

## Self Descriptive Numbers

Overview In this article we will write a program to find if the given number is a Self Descriptive Number or not. In mathematics, a self-descriptive number is an integer m that in a given base b is b digits long in which each digit d at position n (the most significant digit being atContinue reading “Self Descriptive Numbers”

## Between Two Sets

Overview In this article we will try to solve one of the problem mentioned in Hacker Rank. The name of the problem is Between Two Sets. There will be two arrays of integers. Determine all integers that satisfy the following two conditions: The elements of the first array are all factors of the integer beingContinue reading “Between Two Sets”

## Flipping Bits

Overview In this article we will try to solve one of the problem from Hacker Rank. The problem is called Flipping Bits. You will be given a list of 32 bit unsigned integers. Flip all the bits (1 –> 0 and 0 –> 1) and return the result as an unsigned integer. Example n =Continue reading “Flipping Bits”

## Origin containing triangle

Overview In this article we will try to solve a problem mention in the Perl Weekly Challenge called Origin-containing triangle. We are given the coordinates of the triangle A(x1, y1), B(x2, y2) and C(x3, y3). We need to find whether the origin O(0, 0) lies between the triangle. Solution What we need to do isContinue reading “Origin containing triangle”

## HackerRank – Making Anagrams

Overview In this article we will see how to solve the Making Anagrams problem mentioned in Hacker rank. A student is taking a cryptography class and has found anagrams to be very useful. Two strings are anagrams of each other if the first string’s letters can be rearranged to form the second string. In otherContinue reading “HackerRank – Making Anagrams”

## Convert time format 12Hr/24Hr

Overview In this article we will see how to convert a 12 hour time format to a 24 hour one and vice versa. For example a 05:15pm in a 24 hour format is represented as 17:15. 12:00 am is represented as 00:00. Similarly, 19:15 in 24 hour format is represented as 07:15pm in a 12Continue reading “Convert time format 12Hr/24Hr”

## Minimum Triangle Sum – Java/Kotlin

Overview In this article we will try to solve one of the problem mentioned in Perl Weekly Challenge in Java. The problem is called Triangle Sum. You are given triangle array. You need to find the minimum path sum from top to bottom. When you are on index i on the current row then youContinue reading “Minimum Triangle Sum – Java/Kotlin”

## Hacker Rank – Apple and Orange

Overview In this article we will try to solve one of the problem from Hacker Rank. It’s called Apple and Orange. Sam’s house has an apple tree and an orange tree that yield an abundance of fruit. Using the information given below, determine the number of apples and oranges that land on Sam’s house. sContinue reading “Hacker Rank – Apple and Orange”

## Hacker Rank – Time Conversion – Java/Kotlin

Overview In this article we will try to solve the Time Conversion problem mentioned in Hacker Rank. Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Example Code First get the values of hours, minutes and seconds: Now we need to check whether it’s AM or PM time because the conversionContinue reading “Hacker Rank – Time Conversion – Java/Kotlin”