Skip to content
the poor coder

Home / Author

Poor Man

2,994 posts
2020

Sherlock and Moving Tiles Solution

Sherlock is given square tiles, initially both of whose sides have length placed in an plane; so that the bottom left corner of each square coincides with the the origin and their sides are parallel to the axes. At…

Hackerrank1 min read
2020

Hackerrank - Symmetric Difference Solution

Objective Today, we're learning about a new data type: sets. Concept If the inputs are given on one line separated by a space character, use split() to get the separate values in the form of a list: If the list values…

Hackerrank3 min read
2020

Set .discard(), .remove() & .pop() Solution

.remove(x) This operation removes element from the set. If element does not exist, it raises a KeyError. The .remove(x) operation returns None. Example>>> s = set([1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> s.remove(5) >>> print s…

Hackerrank3 min read
2020

Hackerrank - Any or All Solution

any() This expression returns True if any element of the iterable is true. If the iterable is empty, it will return False. Code all() This expression returns True if all of the elements of the iterable are true. If the…

Hackerrank1 min read
2020

Hackerrank - Iterables and Iterators Solution

The itertools module standardizes a core set of fast, memory efficient tools that are useful by themselves or in combination. Together, they form an iterator algebra making it possible to construct specialized tools…

Hackerrank1 min read
2020

Hackerrank - Words Score Solution

In this challenge, the task is to debug the existing code to successfully execute all provided test files. Consider that vowels in the alphabet are a, e, i, o, u and y. Function score_words takes a list of lowercase…

Hackerrank2 min read
2020

Hackerrank - ginortS Solution

You are given a string S. S contains alphanumeric characters only. Your task is to sort the string in the following manner: All sorted lowercase letters are ahead of uppercase letters. All sorted uppercase letters are…

Hackerrank1 min read
2020

Athlete Sort Solution

You are given a spreadsheet that contains a list of athletes and their details (such as age, height, weight and so on). You are required to sort the data based on the th attribute and print the final resulting table…

Hackerrank1 min read
2020

Regex Substitution Solution

The re.sub() tool (sub stands for substitution) evaluates a pattern and, for each valid match, it calls a method (or lambda).The method is called for all matches and can be used to modify strings in different ways.

Hackerrank2 min read
2020

Validating Credit Card Numbers Solution

You and Fredrick are good friends. Yesterday, Fredrick received credit cards from ABCD Bank. He wants to verify whether his credit card numbers are valid or not. You happen to be great at regex so he is asking for your…

Hackerrank2 min read
2020

Hackerrank - Reduce Function Solution

Given a list of rational numbers,find their product. Concept The reduce() function applies a function of two arguments cumulatively on a list of objects in succession from left to right to reduce it to one value. Say…

Hackerrank1 min read
2020

Hackerrank - Maximize It! Solution

You are given a function . You are also given lists. The list consists of elements. You have to pick one element from each list so that the value from the equation below is maximized:

Hackerrank5 min read
2020

Hackerrank - Triangle Quest 2 Solution

You are given a positive integer N. Your task is to print a palindromic triangle of size N. For example, a palindromic triangle of size 5 is: You can't take more than two lines. The first line (a for-statement) is…

Hackerrank1 min read
2020

Hackerrank - Time Delta Solution

When users post an update on social media,such as a URL, image, status update etc., other users in their network are able to view this new post on their news feed. Users can also see exactly when the post was published, i.e, how many hours, minutes or seconds ago.

Hackerrank3 min read
2020

Hackerrank - Set .add() solution

If we want to add a single element to an existing set, we can use the .add() operation. It adds the element to the set and returns 'None'. Example Task Apply your knowledge of the .add() operation to help your friend…

Hackerrank1 min read
ESC