You've successfully subscribed to The Poor Coder | Hackerrank Solutions
Great! Next, complete checkout for full access to The Poor Coder | Hackerrank Solutions
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Home
Author
Terms
Privacy
About
Tumblr
Pinterest
Enable dark mode
Python
Beeze Aal
28.Jul.2020
Hackerrank Mean, Var, and Std Solution
mean The mean tool computes the arithmetic mean along the specified axis. import numpy my_array = numpy.array([ [1, 2], [3, 4] ]) print numpy.mean(my_array, axis = 0) #Output : [ 2. 3.] print numpy.mean(my_array, axis = 1) #Output : [ 1.5 3.5] print numpy.mean(my_array, axis
Beeze Aal
28.Jul.2020
Hackerrank Polynomials Solution
poly The poly tool returns the coefficients of a polynomial with the given sequence of roots. print numpy.poly([-1, 1, 1, 10]) #Output : [ 1 -11 9 11 -10] roots The roots tool returns the roots of a polynomial with the given coefficients. print numpy.roots([1, 0, -1]) #Output
Beeze Aal
28.Jul.2020
Hackerrank Linear Algebra Solution
The NumPy module also comes with a number of built-in routines for linear algebra calculations. These can be found in the sub-module linalg. linalg.det The linalg.det tool computes the determinant of an array. print numpy.linalg.det([[1 , 2], [2, 1]]) #Output : -3.0 linalg.eig The linalg.
Beeze Aal
28.Jul.2020
Hackerrank Eye and Identity Solution
Solution in python3Approach 1. import numpy print(numpy.eye(*map(int,input().split())))Approach 2. import numpy N, M = map(int, input().split()) print(numpy.eye(N, M))Solution in python import numpy N,M = map(int,raw_input().split()) print numpy.eye(N,M)
Beeze Aal
28.Jul.2020
Hackerrank Zeros and Ones Solution
Solution in python3Approach 1. import numpy N = list(map(int, input().split())) print(numpy.zeros(N, int)) print(numpy.ones(N, int))Approach 2. import numpy size = tuple(map(int,input().strip().split())) print( numpy.zeros(size, int) ) print( numpy.ones(size, int) )Approach 3. import numpy N = [int(x)
Beeze Aal
28.Jul.2020
Hackerrank Floor, Ceil and Rint Solution
Solution in python3Approach 1. import numpy a = numpy.array(input().split(),float) print(numpy.floor(a),numpy.ceil(a),numpy.rint(a),sep="\n")Approach 2. from numpy import * A = array([float(x) for x in input().split()],float) print(floor(A),ceil(A),rint(A),sep = '\n')Approach
Beeze Aal
28.Jul.2020
Hackerrank Array Mathematics Solution
Basic mathematical functions operate element-wise on arrays. They are available both as operator overloads and as functions in the NumPy module. import numpy a = numpy.array([1,2,3,4], float) b = numpy.array([5,6,7,8], float) print a + b #[ 6. 8. 10. 12.] print numpy.add(a,
Beeze Aal
28.Jul.2020
Hackerrank Shape and Reshape Solution
Solution in python3Approach 1. import numpy print( numpy.array(input().split(" "),int).reshape(3,3) )Approach 2. import numpy l=input().split() a=numpy.array(l,int) a.shape=(3,3) print(a)Approach 3. import numpy A = numpy.array(input().strip().split(),int) print(numpy.reshape(A,(3,3)
Beeze Aal
28.Jul.2020
Hackerrank Detect HTML Tags, Attributes and Attribute Values Solution
You are given an HTML code snippet of lines. Your task is to detect and print all the HTML tags, attributes and attribute values. Print the detected items in the following format:Tag1Tag2-> Attribute2[0] > Attribute_value2[0]-> Attribute2[1] > Attribute_value2[1]->
Beeze Aal
27.Jul.2020
Hackerrank HTML Parser - Part 2 Solution
*This section assumes that you understand the basics discussed in HTML Parser - Part 1 .handle_comment(data) This method is called when a comment is encountered (e.g. <!--comment-->). The data argument is the content inside the comment tag: from HTMLParser import HTMLParser class MyHTMLParser(HTMLParser): def
Beeze Aal
27.Jul.2020
Hackerrank HTML Parser - Part 1 Solution
HTML Hypertext Markup Language is a standard markup language used for creating World Wide Web pages. Parsing Parsing is the process of syntactic analysis of a string of symbols. It involves resolving a string into its component parts and describing their syntactic roles. HTMLParser An HTMLParser instance is fed HTML
Beeze Aal
27.Jul.2020
Hackerrank Class 2 - Find the Torsional Angle Solution
You are given four points and in a 3-dimensional Cartesian coordinate system. You are required to print the angle between the plane made by the points and in degrees(not radians). Let the angle be . where x and x . Here, means the dot product of and , and x means the
More Posts