Hackerrank
Hackerrank - 2D Array - DS - Solution
Given a 2D Array, : 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 We define an hourglass in to be a subset of
Hackerrank
Given a 2D Array, : 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 We define an hourglass in to be a subset of
Hackerrank
A bracket is considered to be any one of the following characters: (, ), {, }, [, or ]. Two brackets are considered to be a matched pair if the an opening bracket (i.e., (, [, or {) occurs to the left of a closing bracket (i.e., ), ], or }) of the exact same type. There are three types
Hackerrank
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 , both squares start moving along line (along the positive and ) with
Hackerrank
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: >> a = raw_input() 5 4 3 2 >>
Hackerrank
.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
Hackerrank
any() This expression returns True if any element of the iterable is true. If the iterable is empty, it will return False. Code >>> any([1>0,1==0,1<0]) True >>> any([1<0,2<1,3<2]) False
Hackerrank
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 succinctly and efficiently in pure Python. To read more about the functions in this module, check out
Hackerrank
Hackerrank - Print Function Solution
Hackerrank
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 words as an argument and returns a score as follows:
Hackerrank
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 ahead of digits. * All sorted odd digits are ahead of sorted even digits. Input
Hackerrank
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. Follow the example given below for better understanding. Note that
Hackerrank
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.