zengxianbing / leetcode-java

My Java solutions for LeetCode Online Judge.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

gradle eclipse

Generate a file for a question

gradle 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.

gradle test

About

My Java solutions for LeetCode Online Judge.