HackerRank Polar Coordinates solution in python | python example solution

Polar coordinates are an alternative way of representing Cartesian coordinates or Complex Numbers.A complex number  is completely determined by its real part  and imaginary part .Here,  is the imaginary unit.A polar coordinate () is completely determined by modulus  and…

Continue ReadingHackerRank Polar Coordinates solution in python | python example solution

HackerRank itertools.permutations() solution in Python | python problem solution

itertools.permutations(iterable[, r])This tool returns successive  length permutations of elements in an iterable.If  is not specified or is None, then  defaults to the length of the iterable, and all possible full length permutations are generated.Permutations…

Continue ReadingHackerRank itertools.permutations() solution in Python | python problem solution

HackerRank collections.Counter() solution in Python | python problem solution

 collections.Counter()A counter is a container that stores elements as dictionary keys, and their counts are stored as dictionary values.Sample Code>>> from collections import Counter>>> >>> myList = [1,1,2,3,4,5,3,2,3,4,2,1,2,3]>>> print Counter(myList)Counter({2:…

Continue ReadingHackerRank collections.Counter() solution in Python | python problem solution

HackerRank Merge the Tools! solution in python | python problem solution

 Consider the following:A string, , of length  where .An integer, , where  is a factor of .We can split  into  substrings where each subtring, , consists of a contiguous block of  characters in . Then, use each  to create string  such that:The characters…

Continue ReadingHackerRank Merge the Tools! solution in python | python problem solution

HackerRank The Minion Game solution in python | python question solution

Kevin and Stuart want to play the 'The Minion Game'.Game RulesBoth players are given the same string, .Both players have to make substrings using the letters of the string .Stuart has to…

Continue ReadingHackerRank The Minion Game solution in python | python question solution

HackerRank Capitalize! problem solution in Python | python problem solution

You are asked to ensure that the first and last names of people begin with a capital letter in their passports. For example, alison heck should be capitalised correctly as Alison Heck.Given a…

Continue ReadingHackerRank Capitalize! problem solution in Python | python problem solution

HackerRank Alphabet Rangoli problem solution in python | python problem solution

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…

Continue ReadingHackerRank Alphabet Rangoli problem solution in python | python problem solution

HackerRank Designer Door Mat problem solution in Python | python problem 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…

Continue ReadingHackerRank Designer Door Mat problem solution in Python | python problem solution

HackerRank Text Wrap problem solution in Python | python problem solution

You are given a string  and width .Your task is to wrap the string into a paragraph of width .Function DescriptionComplete the wrap function in the editor below.wrap has the following parameters:string string: a long stringint max_width: the…

Continue ReadingHackerRank Text Wrap problem solution in Python | python problem solution