TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

HackerRank aims to build a fun place for programmers to hang out

39 pointsby rvivekalmost 13 years ago

25 comments

jaredsohnalmost 13 years ago
A few things:<p>* I'm having issues with the terminal where what I type is not always on the bottom line. Also, the up/down arrows for getting command history don't always show what I would expect and I get latency fairly frequently.<p>Also <i>spoiler</i> here's an algorithm that will let you win every time where it is possible to win. I debated a bit about posting this, but if I didn't I'm sure somebody else would.<p>1. If number is divisible by 6, do not play since you'll always lose.<p>2. If the number is less than 6, do not play since it doesn't allow you to take them all in the first move, despite what the instructions suggest.<p>3. Otherwise, your first pick should be a number that takes the remaining number to a multiple of six (see rule #1). Then, you should look at what number the computer picks and subtract it from six when you pick your number.<p>Getting to the top of the leaderboard is dependent on understanding this and how much time you're willing to spend playing.<p>Or you could write a bot that plays the game for you. Then getting to the top of the leaderboard depends on who started their bot first and the quality of bots' network connections.
评论 #4178505 未加载
quandrumalmost 13 years ago
Was able to sign up, but the challenge totally failed on me.<p>First it seemed to not be taking any input, and let me enter about 10 different numbers without response. Then, it showed me the back and forth between me and the computer for about half of those numbers, but the total never changed after that.
评论 #4178410 未加载
whichdanalmost 13 years ago
The game worked fine for me, just double check "challenge 1" since it asks for a range between "1 and 0"<p>A few observations:<p>- If you start &#60;= 6, you will always lose, since you have to choose 1 less than the starting number.<p>- Whoever gets 6 on their turn will always lose.<p>- If you start between 7 and 11, you'll always win.<p>- If you start at 12 or higher, you'll usually lose, since the computer will try to get you to 6.<p>Still fun for a few minutes atleast. No idea how people are winning 20+ games.
评论 #4178803 未加载
评论 #4178826 未加载
评论 #4178707 未加载
评论 #4178562 未加载
recursivealmost 13 years ago
The CLI seems to get into an inconsistent state easily in Chrome, only fixed by reloading the page. I'm sure I know how to win the candy challenge based on the english description of the rules, but I can't make any sense of the output.<p><pre><code> recursive@hackerrank:~$ challenge 1 Playing a game for N: 1 Please provide a number between 1 or 0. How many candies you want to pick?: </code></pre> At this point, I get stuck in a loop that I've only been able to get out of with f5.
aylaalmost 13 years ago
I am a novice programmer and I am always put off websites that rank users (and programming competitions for that matter). Avoiding the competition seems better than putting my relatively crappy code out there for all to see.<p>Would more seasoned people out there agree that a clean slate is better than a low ranking on sites like InterviewStreet (or HackerRank if it gets big)?
评论 #4178399 未加载
评论 #4178677 未加载
xiaomaalmost 13 years ago
Well, I was trying to avoid spoilers, but since jaredsohn has already sailed that boat out to sea...<p>How do you script something like this? I tried looking at the source and then using the chrome console to input jQuery commands, but something really weird happened. I could replace just about any element on the screen <i>except the one that mattered</i>!<p>I could type "challenge 8" into the console and then running a $('tester').text() would return "challenge 8" as expected. But $('tester').text('challenge 9') wouldn't update the screen. I tried for a good hour to find a way to update the text in that element, with no luck (short of removing the whole thing from the dom).<p>(see <a href="http://postimage.org/image/c3xkrg8y3/" rel="nofollow">http://postimage.org/image/c3xkrg8y3/</a> )<p>Also how do you send a carriage return? Inserting a newline didn't seem to do the trick. Anyone? As much as I love a challenge, beating my head against this one issue doesn't yield much education / time spent.
评论 #4180299 未加载
dxbydtalmost 13 years ago
Vivek, Cannot access at the bank. Contacted friends at other banks. Same story :( So some 1 million plus corporate programmers don't have access to your website. Here's the message I get on Internet Explorer.<p>--------- 403 Forbidden<p>This Web site is blocked: <a href="http://hackerrank.com/" rel="nofollow">http://hackerrank.com/</a> As part of our ongoing effort to protect the bank and its information, the Web site you are trying to reach is blocked because it is classified in a category the bank considers to have certain risks. The bank blocks access to a number of Web site classifications including but not limited to Web mail sites, Personal Network Storage, and other categories to comply with regulations, protect customer and company information, and to be consistent with industry standards and practices.<p>This Web site is categorized as Games. ---------
评论 #4178840 未加载
ehaugheealmost 13 years ago
Am I missing something? I type signup myemail myusername and I am then prompted for a password which seems to refuse any input or at least not alert me of submission.
评论 #4178305 未加载
Nick5a1almost 13 years ago
I am a very novice programmer, but this challenge seems impossible. It asks "Please provide a number between 1 or -1". That isn't even English. Do you mean between 1 <i>and</i> -1? Any number entered just results in the same "Please provide a number between 1 or -1".<p>Did you not test this at all before promoting it? I am brand new to programming and even I know that testing is important.
评论 #4178849 未加载
评论 #4178419 未加载
dwerthenalmost 13 years ago
I most certainly enjoyed that! Was nice to find the apply command after poking around in the help.<p><pre><code> == apply: Apply to join our awesome team. Usage: apply &#60;a profile url&#62; &#60;why do you want to apply&#62; </code></pre> Does it have anything to do with my mad skillz in solving the puzzle perhaps? ;-)
obliojoealmost 13 years ago
This looks cool. But I'm getting a javascript error when trying to sign up.<p>TypeError: Cannot call method 'toLowerCase' of undefined [<a href="http://www.hackerrank.com/assets/application-18e8ea124a726771ae0f901e4094ee4f.js:16" rel="nofollow">http://www.hackerrank.com/assets/application-18e8ea124a72677...</a>]
评论 #4178313 未加载
iambibhasalmost 13 years ago
And just found a bug. I started from 2000 and it got stuck at 378. It is miscalculating and thus going into an infinite loop. <a href="http://paste.ubuntu.com/1067434/" rel="nofollow">http://paste.ubuntu.com/1067434/</a> I mean come on, mathematical miscalculation for a game like this?
calinet6almost 13 years ago
The algorithm is obviously pretty easy, as has been demonstrated...<p>but I can't believe I just spent 20 minutes trying to come up with a scripted solution. Nerd sniped again!<p><a href="http://xkcd.com/356/" rel="nofollow">http://xkcd.com/356/</a>
评论 #4179140 未加载
gms7777almost 13 years ago
So maybe I just fail, but I attempted to sign up, typed in the command and then it asked for a password. I assumed this was to make up a password, so I tried that, and it didn't let me enter. Is this a you have to know a password to sign up thing?
评论 #4178319 未加载
rsobersalmost 13 years ago
I'm going crazy or should I not have won here?<p>Playing a game for N: 10 Your move: '4'. Computer's move: '1'. Remaining candies: '5' Please provide a number between 1 or 5. Your move: '5'. Computer's move: '5'. Sorry! You lost the game.
评论 #4178764 未加载
theonewolfalmost 13 years ago
hey passwords are being sent plaintext (<a href="https://gist.github.com/3020091/" rel="nofollow">https://gist.github.com/3020091/</a>). be careful if you signup/when you log in. use a password you don't care about, or use a throwaway.
llaxsllalmost 13 years ago
Ha! I attempted this yesterday, after I saw the article in TC. It was a really fun challenge! Good job guys! Hope I didn't cost you a lot of money.. by my estimates i sent you something close to like a million requests .. give or take.
kienntalmost 13 years ago
You guys rock !!!<p>I also write new bot by python for hackerrank challenge. Check out my code at <a href="https://github.com/kiennt/hackerrank-bot" rel="nofollow">https://github.com/kiennt/hackerrank-bot</a><p>Happy hacking :)
评论 #4229104 未加载
manish_gillalmost 13 years ago
There's a bug. The cursor sometimes shows up above the current prompt line and I'm not able to type. Clicking on the prompt will just bring it back for a second and then it goes up again.
gdi2290almost 13 years ago
$ Playing a game for N: 8 $ Your move: '2'. Computer's move: '2'. Remaining candies: '4' $ Congrats! You won the game. Now go ahead and play for more candies. Enjoy :)
think-largealmost 13 years ago
Can you give solutions after the week is up? I really want to become a better programmer and I think this would really help me learn.
评论 #4179126 未加载
RegExalmost 13 years ago
"Username can only contain characters, numbers and underscore." _RegEx_ doesn't work :(
daguaralmost 13 years ago
I'm getting a whole mess of "You can't play that game!" errors on legitimate moves.
评论 #4183133 未加载
vemuruadialmost 13 years ago
Awesome stuff man...looking fwd to more challenges.
chimeracoderalmost 13 years ago
I must say, this 'challenge' is a creative idea.<p>However, not to be a wet blanket, but it's rather simple to construct a winning algorithm, particularly if you can both choose the same starting number and always go first (and choose the same starting number multiple times). If I had a few extra minutes at work right now, I'd take a stab at it.<p>...That is, unless that's the entire point?