/leetcode-java-1

My Java solutions for LeetCode Online Judge.

Primary LanguageJava

leetcode-java

My Java solutions for LeetCode Online Judge.

Build Status

Build Status

Requirements

  • Java >= 1.6
  • Gradle >= 1.8.6 (1.8.6 is the only version I have tried)

Generate an eclipse project

./gradlew eclipse

Generate an IntelliJ IDEA project

./gradlew idea

Generate a file for a question

./gradlew question "-Pq=Some Question"

The above command will generate a source file called src/main/java/some_question/SomeQuestion.java, and you can write your solution in this file directly.

Unit tests are also embedded as inner classes of the main code. For an explanation of this design choice see Ben J. Christensen's JUnit Tests as Inner Classes.

Run unit tests

If you write some unit tests, you can use the following command to run them.

./gradlew test