hackerrank programming problems

A forum for general discussion of the Python programming language.

hackerrank programming problems

Postby russ » Thu Mar 07, 2013 3:38 pm

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

Postby StormJedi » Sat Mar 09, 2013 1:51 pm

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

Postby ichabod801 » Sat Mar 09, 2013 2:26 pm

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.
Craig "Ichabod" O'Brien
Minimalist, buddhist, theist, and programmer
Current languages: Python, SAS, and C++
Previous serious languages: R, Java, VBA, Lisp, HyperTalk, BASIC
ichabod801
 
Posts: 84
Joined: Sat Feb 09, 2013 12:54 pm
Location: Outside Washington DC

Re: hackerrank programming problems

Postby micseydel » Sat Mar 09, 2013 7:47 pm

Where's the link for the primes challenge?
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1270
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: hackerrank programming problems

Postby ichabod801 » Sat Mar 09, 2013 8:25 pm

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.
Craig "Ichabod" O'Brien
Minimalist, buddhist, theist, and programmer
Current languages: Python, SAS, and C++
Previous serious languages: R, Java, VBA, Lisp, HyperTalk, BASIC
ichabod801
 
Posts: 84
Joined: Sat Feb 09, 2013 12:54 pm
Location: Outside Washington DC

Re: hackerrank programming problems

Postby micseydel » Sat Mar 09, 2013 8:34 pm

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.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1270
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: hackerrank programming problems

Postby ichabod801 » Sat Mar 09, 2013 9:40 pm

Craig "Ichabod" O'Brien
Minimalist, buddhist, theist, and programmer
Current languages: Python, SAS, and C++
Previous serious languages: R, Java, VBA, Lisp, HyperTalk, BASIC
ichabod801
 
Posts: 84
Joined: Sat Feb 09, 2013 12:54 pm
Location: Outside Washington DC

Re: hackerrank programming problems

Postby micseydel » Sat Mar 09, 2013 10:00 pm

Ah, when logged in, that URL redirects to the dashboard. I had to logout and view the page to find that problem.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1270
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 2 guests