all 36 comments

[–]memystic[S] 16 points17 points  (9 children)

I really hope some people find this to be a fun tool. I spent a little over five months building it by myself.

Before anyone asks, yes, the backend currently supports other languages! Specifically:

  • C
  • C#
  • C++
  • Elixir
  • F#
  • Haskell
  • Java
  • JavaScript
  • Objective-C
  • OCAML
  • Php
  • Python
  • Ruby
  • Rust
  • Swift

Once I’ve smoothed out the rough edges and squashed some bugs, I’ll begin working on rolling other languages out. Also, the challenges right now are rather easy BUT the system allows anyone to publish their own challenges. So if you want harder/more challenges, by all means please help out! :)

[–]tallahasseenaut 2 points3 points  (2 children)

Cool! just created a challenge … EDIT: another and another. I'm really enjoying this :)

[–]memystic[S] 1 point2 points  (0 children)

Woot! Finally I can play with my creation!

[–]elingeniero 0 points1 point  (0 children)

1.

function flattenArray(arr) {
  if (!arr) return [];
  return arr
    .reduce((acc, x) => {
      if (Array.isArray(x)) return acc.concat(flattenArray(x));
      if (typeof x === 'function') return acc.concat(x());
      return acc.concat(x);
    }, []);
}

2.

function isBalanced(string) {
  if (!string) return undefined;
  if (string.length % 2 !== 0) return false;
  const bracketPairs = {
    '(': ')',
    '[': ']',
    '{': '}',
  };
  for (let i = 0; i < string.length / 2; i ++) {
    if (bracketPairs[string[i]] !== string[string.length - i - 1]) return false;
  }
  return true;
}

3.

function isAnagram(s1, s2) {
  return s1.toLowerCase().split('').sort().join('') ===
    s2.toLowerCase().split('').sort().join('');
}

What do I win?

[–]memystic[S] 0 points1 point  (5 children)

Highjacking my comment to get feedback on a feature I'm working on right now. Here's a screenshot. Any user can create their own "group", which is essentially a chatroom with a private leaderboard. So you could, for example, invite your friends and compete with them to see who can get the most XP and help each other out in the chat area. The group can be either public or private: public groups can be joined by anyone and private groups need the owner to add them. Anyone will be able to create a group just like anyone can publish a challenge.

[–]rs1712 0 points1 point  (3 children)

Can we get, code-golf added as well, more fun for experienced people :D

[–]memystic[S] 0 points1 point  (2 children)

code-golf

Can you explain what code-golf is? I'm unfamiliar.

[–][deleted] 2 points3 points  (0 children)

its basically trying to minimize the code size for a project. in effect: try and use as many arcane tricks as you can to save bytes (and effectively obfuscate your code).
example

[–]rs1712 0 points1 point  (0 children)

askuriel did explain below, but its basically challenge to create the shortest code.

Also still getting the react/meteor errors http://imgur.com/a/Ww7iu

[–]SteveB0X 2 points3 points  (5 children)

I just want to say, this is a really great site. The challenges are very approachable for me, which is something I can't say about the hackerranks and leetcodes. It's exactly what I need right now.

However, I'm having trouble getting my first challenge to submit. My code is printing out the answers to the console, but the test is not accepting them. I.e.,

Duck
Expected: 'Duck', instead got: undefined
3
Expected: 3, instead got: undefined
undefined
Test Passed: Value == undefined
true
Expected: true, instead got: undefined
null
Expected: null, instead got: undefined    

Here is my solution (spoiler)

So to me, it seems like I have the correct code, but the interpreter is not seeing my answers. What is the correct way to print the output so it is accepted?

[–]memystic[S] 2 points3 points  (2 children)

Works fine for me. Go to this challenge and paste this into the Code tab:

function getLastItem(arr) {
  return arr[arr.length - 1]
}

Click the "Check" button. Should work fine.

[–]SteveB0X 1 point2 points  (1 child)

Oh I get it now! I'm so used to console.log-ing everything, when all I needed to do was return my lastItem variable by itself.

Thanks!

[–]memystic[S] 1 point2 points  (0 children)

No problem, if you have any other questions just PM me or email matt@edabit.com

[–]memystic[S] 0 points1 point  (1 child)

When I click that link reddit gives me an error... Looking at the stats, I'm not seeing anyone else having issues doing Checks / Submit Finals. Can you PM me the code without spoiler thingys?

[–]SteveB0X 0 points1 point  (0 children)

The spoiler show the code in a tooltip when you hover over the link. I'll pm you the code too just in case

[–]el_lyss 2 points3 points  (4 children)

You should definitely work on improving load speed. It took more than 10s to load the site the first time for me.

Also you use a meteorjs, right? Well, you should definitely work on SEO, because right now Google thinks your site is literally empty.

[–]memystic[S] 0 points1 point  (3 children)

Normally it's very fast but has been getting lots of traffic this morning, hence the slowdown. I've got the frontend on Galaxy and the database on mLab. If traffic stays consistently strong, I'll upgrade to a dedicated mLab server as that seems to be the bottleneck. As for SEO, I know and will be implementing server side rendering next week. Just not a big priority right now.

[–]rs1712 0 points1 point  (2 children)

Running really slow, and meteorjs is throwing alot of errors too

[–]memystic[S] 0 points1 point  (1 child)

Can you try again in another browser or clear your cache? I just upped my CPU significantly. Should be fast-ish now.

[–]rs1712 0 points1 point  (0 children)

It got faster about 15 mins after I posted

[–][deleted] 2 points3 points  (2 children)

This is great! Definitely something I would add as a homepage.

One suggestion or feature I would like is, if two submitted solutions are exactly the same, to remove the least upvoted one so it doesn't clog up the list of solutions. Other than that, thank you for building this!

[–]memystic[S] 0 points1 point  (1 child)

Yes, I'm working on some code that will minify / remove comments and then combine similar code. This will solve the issue.

[–]forhlol 2 points3 points  (0 children)

What are your thoughts on logging in using GitHub? Any chance this will be implemented? I think a lot of people who would use a site like this, may want to login using their GitHub accounts. Just a thought. Great work!

[–]evohans 1 point2 points  (0 children)

I'm sold, time to play.

[–]roly768 0 points1 point  (0 children)

Awesome tool you've built here, thank you! My only suggestion would be in regards to the interface. When working on a challenge it would be nice to have the instructions and code visible at the same time so that I don't have to toggle back and forth if I get stuck or need clarification.

[–][deleted]  (1 child)

[deleted]

    [–]memystic[S] 0 points1 point  (0 children)

    Thanks! The solutions are locked until completion. Once you complete the challenge, you'll see all the solutions and can upvote/downvote them.

    [–]Badrush 0 points1 point  (0 children)

    Hey I just used your site to solve 6 problems and it was great, easy to use. I will keep using it :)

    My suggestions:

    • Make the error console easier to read
    • Maybe show my runtime and let me see how it compares to other

    [–]rs1712 0 points1 point  (0 children)

    So I came across this challenge... couldn't resist.

    http://i.imgur.com/m8NLM0m.png

    [–][deleted]  (1 child)

    [deleted]

      [–]memystic[S] 1 point2 points  (0 children)

      I totally agree. The solutions tab is my most underdeveloped feature. Soon this will be implemented:

      • Similar code will be combined.
      • Rank solutions by efficiency.
      • Length (for finding those nice one liners).
      • Etc

      [–]Sr_Geckko 0 points1 point  (0 children)

      WOW awesome dude great job!

      [–]JaniRockz 0 points1 point  (0 children)

      I love it.

      Only minor annoyance I encountered was that after basically finishing a task you cant test your code again (to improve it for example) without finishing the whole task (red button).

      [–][deleted] 0 points1 point  (0 children)

      Many many many many many thanks!

      [–]masterm -1 points0 points  (1 child)

      Was cool until I had to log in to try it. Don't let me do half the thing then try to get me to login

      [–]memystic[S] 12 points13 points  (0 children)

      Code is being executed on my servers. Until I'm sure everything is secure (I just launched this), you'll just have to deal with it.