Giter VIP home page Giter VIP logo

hackergymcontent's Introduction

What is this ?

This repo contains solutions for coding challenges on http://hackergym.com.

For each question, there are multiple solutions available in Java. In addition, all solutions come with extensive unit tests that test for correctness and common pitfalls and edge cases.

More importantly, each solution contains placeholders for you own custom solution. You can add your own solutions to these placeholders and all the unit tests will automatically run on it and verify it's correctness.

How to use this ?

The best way to use this repo is along with http://hackergym.com.

We recommend that you go through each question using the simulated environment on the website. Then, if you have a better solution and want to verify it use this repo to run our unit tests against it.

How to set up

First you need to install JDK 8 from here.

After the installation do the following to make sure you have the correct version:

$ javac -version

Now download the zip/tar file from top of this page and unzip it. Then follow the instructions below for your favorite java development tool.

Command Line

From the extracted folder:

$ cd JavaSolutions/
$ ./gradlew
$ ./gradlew test

This will run all the unit tests against the code.

You can use the ./gradlew to run any task inlcuding build and test.

Eclipse

First install Gradle from Eclipse Marketplace: Help -> Eclipse MarketPlace :

image:

Now set you project java version to 1.8: Project -> Properties :

image

Having installed the Gradle plugin, import the project as a Gradle project: File -> Import

image

Finally, open the Gradle Task view and run with test: Window -> Show View -> Other

image

This will run all of the unit tests on the solutions.

IntellijIDEA

First install The Gradle Plugin:IntelliJ IDEA -> Preferences -> plugins

image

Now import the project: File -> Import Project image

Now set you JDK to 1.8: File -> Project Structure image

Make sure that Project Language level is set to 8.0 and also that your ```Project SDK`` is pointing to your JDK 8 installation.

Finally, Run the Gradle Task window and run the test task: view -> Tool Windows -> Gradle:

image

##Project Structure

Under the src folder there are two standard folders:

  • src/main/java : Contains the actual code for solutions. Each topic has its own package and the name of the classes correspond with the name of the questions on http://hackergym.com
  • src/test/java : Contains the unit tests for solutions. The name of the packages and classes correspond with the packages and classess under src/main/java

##How to Add your Custom Solutions

If you go under each problem, you will see a section describing the problem and a method as soon as the class begins. The method usually has a big comment block saying "Your Custom Solution". All you need to do is to remove the existing line of code in that method and write your own solution there.

image

Once you are done, you can run the unit tests against your solution using one of the approaches explained above.

image

Unit tests will be run against your custom solution. These unit tests contain the word Custom in them so that they are easy to spot.

##What's next HackerGym gets updates every week with a new batch of questions. So check the repo frequently so that you don't miss new questions.

##Support If you have any trouble setting up your environment or see a wrong solution, contact [email protected] or open an issue here.

If you have better solutions, want to modify existing solutions, or have a solution in other languages fork the repo and send us a pull request. We will merge your changes as soon as possible.

##License MIT LICENSE

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

hackergymcontent's People

Contributors

fathalian avatar farzadsangi avatar

Watchers

Nilesh Patel avatar

Forkers

jainankit49

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.