Skip to content
the poor coder

Home / Author

Poor Man

2,994 posts
2020

Hackerrank - itertools.product() Solution

itertools.product() This tool computes the cartesian product of input iterables. It is equivalent to nested for-loops. For example, product(A, B) returns the same as ((x,y) for x in A for y in B). Sample Code Task You…

Hackerrank2 min read
2020

Hackerrank - Designer Door Mat Solution

Mr. Vincent works in a door mat manufacturing company. One day, he designed a new door mat with the following specifications: Mat size must be X. ( is an odd natural number, and is times .) The design should have…

Hackerrank2 min read
2020

Hackerrank - Alphabet Rangoli

You are given an integer, . Your task is to print an alphabet rangoli of size . (Rangoli is a form of Indian folk art based on creation of patterns.) Different sizes of alphabet rangoli are shown below: The center of…

2020

Hackerrank - Filling Jars Solution

Animesh has N empty candy jars, numbered from 1 to N, with infinite capacity. He performs M operations. Each operation is described by 3 integers, a, b, and k. Here, a and b are indices of the jars, and k is the number…

2020

Hackerrank - Restaurant Solution

Martha is interviewing at Subway. One of the rounds of the interview requires her to cut a bread of size into smaller identical pieces such that each piece is a square having maximum possible side length with no left…

2020

Hackerrank - Connecting Towns Solution

Gandalf is travelling from Rohan to Rivendell to meet Frodo but there is no direct route from Rohan (T1) to Rivendell (Tn). But there are towns T2,T3,T4...Tn-1 such that there are N1 routes from Town T1 to T2, and in…

2020

Sherlock and Permutations

Watson asks Sherlock: Given a string S of N 0's and M 1's, how many unique permutations of this string start with 1? Help Sherlock by printing the answer modulo (109+7). Input Format First line contains T, the number of…

2020

Hackerrank - Apple and Orange Solution

Sam's house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram below, the red region denotes his house, where is the start point, and is the endpoint. The apple tree is to the left of…

2020

Hackerrank - Time Conversion Solution

Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a…

2020

Hackerrank - Mini-Max Sum Solution

Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two…

2020

Hackerrank - Staircase Solution

Consider a staircase of size : Observe that its base and height are both equal to , 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…

2020

Hackerrank - Plus Minus Solution

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. Note: This challenge introduces precision problems…

2020

Hackerrank - A Very Big Sum Solution

Calculate and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large. Function Description Complete the aVeryBigSum function in the editor below. It must return the sum…

2020

Hackerrank - Simple Array Sum Solution

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. Function Description Complete the simpleArraySum function in the editor below. It must return the…

2020

Hackerrank - Solve Me First Solution

Complete the function solveMeFirst to compute the sum of two integers. Function prototype: int solveMeFirst(int a, int b); where, a is the first integer input. b is the second integer input Return values sum of the…

Hackerrank1 min read
2020

Hackerrank Mathematics- Die Hard 3 Solution

Simon: On the fountain, there should be 2 jugs - a 5 gallon and a 3 gallon. Do you see them? Fill one of the jugs with exactly 4 gallons of water and place it on the scale and the timer will stop. You must be precise…

Hackerrank3 min read
ESC