Hackerrank Zeros and Ones Solution
1 min read

Hackerrank Zeros and Ones Solution

Hackerrank Zeros and Ones Solution

Solution in python3

Approach 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) for x in input().split()]
print(numpy.zeros(N, dtype = numpy.int))
print(numpy.ones(N, dtype = numpy.int))

Solution in python

import numpy
N=map(int,raw_input().split())
print numpy.zeros(N,dtype = numpy.int)
print numpy.ones(N,dtype = numpy.int)

Enjoying these posts? Subscribe for more


Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

That's okay. But without advertising-income, we can't keep making this site awesome.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add thepoorcoder.com to your ad blocking whitelist or disable your adblocking software.

×