Search:
Forum
Beginners
Minute to Win It
Minute to Win It
Jun 22, 2018 at 11:35am UTC
suraja12
(2)
here is the problem statement link
https://www.hackerrank.com/contests/w38/challenges/minute-to-win-it
and my code is
n, k = return map(int, raw_input().split())
arr = return map(int, raw_input().split())
cnt = 0
if n < 2:
print "0"
else:
for i in xrange(1,n):
if arr[i] - arr[i-1] == k:
continue
else:
arr[i] = arr[i-1] + k
cnt += 1
print cnt
Jun 22, 2018 at 1:02pm UTC
keskiverto
(10402)
You have the same problem in logic as in:
http://www.cplusplus.com/forum/beginner/238498/
Jun 22, 2018 at 1:08pm UTC
MikeyBoy
(5631)
1) Your link doesn't work.
2) Please use code tags when posting code, to make it readable:
http://www.cplusplus.com/articles/z13hAqkS/
3) This isn't C++. It looks like Python to me. Why are you posting Python code in a C++ forum?
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs