## hackerrank programming problems

A forum for general discussion of the Python programming language.

### hackerrank programming problems

This is probably old news but I just found this site called hackerrank.com.

I remember searching for and seeing posts on numerous occasions about where to find good programming problems and there is usually a long list of usuals like projecteuler and past ACM problems, but never seen this one.

So far it seems really good and supports python 2 and 3.

Plus I here there is a competition starting today (i think in about half an hour) but there was something about registering first and I wont be at a computer from now for like a day so won't bother.

check it out
russ

Posts: 18
Joined: Sat Mar 02, 2013 8:59 am

### Re: hackerrank programming problems

Just kinda browsed it, but when you select Python 2, it works correctly and changes syntax.
When you select Python 3, nothing happens.
Python 2.7
Python 3.3
Windows 7 x64
Ubuntu 12.10 x64
One day I hope to use one OS and 1 Python flavor, until that day, life goes on.
StormJedi

Posts: 27
Joined: Fri Feb 22, 2013 3:36 pm

### Re: hackerrank programming problems

The webpage wouldn't render at work. I'm assuming it's an IE issue, but still. That first question (print as many primes as you can) was just begging for an infinite loop, so I gave it one:

Code: Select all
primes = [2, 3]
print(2)
print(3)
n = 4
while True:
for p in primes:
if not n % p:
break
else:
primes.append(n)
print(n)
n += 1

That did not run forever, as it should have. Not that I didn't expect a catch for infinite loops, but that would seem to bias the web site against Python. If the check for infinite loops is time based, then for any given Python implementation of the problem you could make a faster C++ implementation with similar code that would print more primes in the given time.

It gave me a score of 1094100 for that, but I'm not sure what that means. When I did an initial test of just:

Code: Select all
print(2)
print(3)

it gave me a score of 200. Maybe that means I printed 10941 primes before the cutoff? It did say I was 35th on the leader board, but the top ten (or four, there were a lot of ties for fourth) were all C or C++.

That was with the Python 3 setting, so it's working for me at least.
Due to the reasons discussed here we will be moving to python-forum.io on October 1st, 2016.
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
ichabod801

Posts: 688
Joined: Sat Feb 09, 2013 12:54 pm
Location: Outside Washington DC

### Re: hackerrank programming problems

Where's the link for the primes challenge?
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.

micseydel

Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

### Re: hackerrank programming problems

micseydel wrote:Where's the link for the primes challenge?

It's on the first page. Scroll down for the description, and then click "Solve Challenge" to get to a page where you can enter code.
Due to the reasons discussed here we will be moving to python-forum.io on October 1st, 2016.
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
ichabod801

Posts: 688
Joined: Sat Feb 09, 2013 12:54 pm
Location: Outside Washington DC

### Re: hackerrank programming problems

The "first page" for me is https://www.hackerrank.com/algorithm/dashboard and the word "description" does not appear on it. When I scroll down I see a header that says "Progress by Track". "Solve challenge" doesn't appear on the page either.

Rather than telling me how to navigate there, could you give me a link? I tried using the search box at the top and searching for "primes" as well but couldn't find it.
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.

micseydel

Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

### Re: hackerrank programming problems

Due to the reasons discussed here we will be moving to python-forum.io on October 1st, 2016.
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
ichabod801

Posts: 688
Joined: Sat Feb 09, 2013 12:54 pm
Location: Outside Washington DC

### Re: hackerrank programming problems

Ah, when logged in, that URL redirects to the dashboard. I had to logout and view the page to find that problem.
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.

micseydel

Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA