Skip to content

Commit

Permalink
Master update on Mar 27 (adnanaziz#30)
Browse files Browse the repository at this point in the history
* Update on 01/31/2018

* Update test framework

* Update programs to match new test framework

* Update explanations in test data

* Add support for better test failure messages

* Remove C++17 features

* Update command-line interface

* Improve test failure info output

* Add missing res_printer in search_for_min_max_in_array.py

* Improve CL interface and test failure output

* Fix res_printer in python

* Update programs and test data

* Move include and import statements to top

* Update test framework

* Suppress long type usage

* Update test data

* updated readme.md

* updated readme.md

* updated readme.md

* updated readme.md

* Add missing problem links and fix incorrect file names

* Use shared configuration file

* Update on 03/27/2018
  • Loading branch information
tsunghsienlee authored Mar 28, 2018
1 parent 22fc662 commit c7ecb08
Show file tree
Hide file tree
Showing 744 changed files with 67,231 additions and 54,933 deletions.
129 changes: 68 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# EPI Judge

## Intro

The EPI Judge is ready! This screenshot should give you a good idea of what it's about.

<img src="http://elementsofprogramminginterviews.com/img/judge-ide-example.png" width="600px"></img>
## Introduction

EPI Judge consists of the following:

Expand All @@ -14,103 +10,107 @@ EPI Judge consists of the following:

## Installation

The installation is super-simple &mdash; there's no install! You just **download the project, point your IDE/editor to it**, and start the code-debug cycle, with instant feedback! You can download the judge as a git project via `git clone`, or just get the source as a [zip](https://github.com/adnanaziz/EPIJudge/archive/master.zip).
Here's how to download the judge:

### C++ project import
$ git clone https://github.com/adnanaziz/EPIJudge.git
If you do not have `git`, here's a good [tutorial](https://www.atlassian.com/git/tutorials/install-git) on installing git itself.

If you want to import the project into your favourite IDE, you probably need to create IDE project with [CMake](https://cmake.org/) (no need to do it for CLion, it supports CMake out-of-the-box).
## Running the judge using IDEs

Here is an example recipe for generationg Visual Studio project ([list](https://cmake.org/cmake/help/v3.10/manual/cmake-generators.7.html) of all CMake supported IDEs).
After installing CMake, open your terminal, go to `epi_judge_cpp` folder and run following commands:
Check out these one minute videos to see how easy it is to get started with the judge.

mkdir vs
cd vs
cmake -G "Visual Studio 15 2017" ..
### Python

Then just open `epi_judge_cpp/vs/epi_judge_cpp.sln` solution with Visual Studio and it will load all EPI programs.
[PyCharm](https://youtu.be/ImD_iI-uGYo), [Eclipse](https://youtu.be/rZ1qqwEXwQY), [NetBeans](https://youtu.be/Z41jW1TyZwY)

### Java

### Supported compilers
[IntelliJ IDEA](https://youtu.be/1BzHUpluQHM), [Eclipse](https://youtu.be/i9uz9Zazo0A)

The judge has been tested with these compilers. Let us know if you managed to compile all programs with an older version.
### C++

- **GCC** 5.4.1 (on Ubuntu 16.04)
- **Clang** 4.0 (on Ubuntu 16.04)
- **Apple LLVM Clang** 9.0.0
- **Visual Studio** 2017 (may be compatible with 2015, though we didn't check it (yet))
- **Java** 8
- **Python** 3.5
[CLion](https://youtu.be/aHPDApyyYEg), [Visual Studio 2017](https://youtu.be/hgd8IIQpBEE)

### IDE guides

Check out one minute screencapture videos on YouTube to see how easy it is to get started with the judge.
## Running the judge from the command line

#### C++
### Python

- [CLion](https://youtu.be/aHPDApyyYEg)
- [Visual Studio 2017](https://youtu.be/hgd8IIQpBEE)
$ python3 <program_name>.py

#### Java

- [IntelliJ IDEA](https://youtu.be/1BzHUpluQHM)
- [Eclipse](https://youtu.be/i9uz9Zazo0A)
Use the [`Makefile`](https://github.com/adnanaziz/EPIJudge/blob/master/epi_judge_java/Makefile).

#### Python
Compile and run a specific program:

- [PyCharm](https://youtu.be/ImD_iI-uGYo)
- [Eclipse](https://youtu.be/rZ1qqwEXwQY)
- [NetBeans](https://youtu.be/Z41jW1TyZwY)
$ make <program_name>
Example:

### Running from command-line
$ make Anagrams
Compile and run the last program that you edited:

#### C++
$ make

You can manually compile and run all programs by directly invoking GCC or Clang compiler. Test framework is header-only, so no separate compilation is needed. Don't forget to add `-std=c++14` switch. Also you may need to provide `-pthread` switch (if you see some link errors with std::thread).
### C++

Alternatively you can use Makefile in epi_judge_cpp directory (use `make <program_name>` for release build and `make <program_name>_dbg` for debug build) or use CMake with the provided CMakeLists.txt file. Default Makefile target ("last") compiles and runs the last edited file.
You can manually compile and run all programs by directly invoking GCC and Clang.

Example:
$ g++ -pthread -std=c++14 -O3 -o anagrams anagrams.cc
You can also use the provided Makefile: `make <program_name>`. You can also use CMake with the provided CMakeLists.txt file.

g++ -pthread -std=c++14 -O3 -o anagrams anagrams.cc
$ make
The default Makefile target is the last edited file.

OR
$ make anagrams

make anagrams

#### Java
## FAQ

Java compilation process is quite complicated, so we recommend you to use the provided Makefile. Run `make <program_name>` to compile and immediately start the program or run `make` to compile and start the last edited file.
- How can I contact the authors?

Example:
Please feel free to send us questions and feedback - `adnan.aziz@gmail.com` and `tsung.hsien.lee@gmail.com`

make Anagrams
- Help, my EPIJudge is not working, what should I do?

#### Python
If you do have issues, e.g., with install or with buggy tests, feel free to reach out to us via email. Please be as detailed as you can: the ideal is if you can upload a screencast video of the issue to youtube; failing that, please upload screenshots. The more detailed the description of the problem and your environment (OS, language version, IDE and version), the easier it’ll be for us to help you.

python3 <program_name>.py
- I'm new to programming, and don't have any kind of development environment, what should I do?

That's all.
The IntelliJ Integrated Development environments described above are best-in-class, and have free versions that will work fine for the EPI Judge. They do not include the compilers. You can get the Java development environment from [Oracle](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), and the Python development environment from [Python.org](https://www.python.org/downloads/). For C++, you have multiple options. The simplest is to install [VisualStudio](https://code.visualstudio.com/download), which includes both the IDE and the compiler. Google is a good resource for installation help.

## Acknowledgments
- What compilers are supported?
- **GCC** 5.4.1 (on Ubuntu 16.04)
- **Clang** 4.0 (on Ubuntu 16.04)
- **Apple LLVM Clang** 9.0.0
- **Visual Studio** 2017
- **Java** 8
- **Python** 3.5

Please send us questions and feedback by email; we're adnan.aziz@gmail.com and tsung.hsien.lee@gmail.com
Let us know if you managed to compile with an older version.

A big shout-out to the hundreds of users who tried out the alpha release over the past couple of months. As always, we never fail to be impressed by the enthusiasm and commitment our readers have; it has served to bring out the best in us.
We all thank [Viacheslav Kroilov](https://github.com/metopa), for applying his exceptional software engineering skills to make EPI Judge a reality.
- What does the UI look like?

## FAQ
Take a look at this screenshot.

- Help, my EPIJudge is not working, what should I do?
<img src="http://elementsofprogramminginterviews.com/img/judge-ide-example.png" width="600px"></img>

If you do have issues, e.g., with install or with buggy tests, feel free to reach out to us via email. Please be as detailed as you can: the ideal is if you can upload a screencast video of the issue to youtube; failing that, please upload screenshots. The more detailed the description of the problem and your environment (OS, language version, IDE and version), the easier it’ll be for us to help you.
- How can I understand the test framework better?

- I'm new to programming, and don't have any kind of development environment, what should I do?
The judge harness is fairly complex (but does not use nonstandard language features or libraries). You are welcome to study it, but we’d advise you against making changes to it (since it will lead to nasty merge conflicts when you update).

The IntelliJ Integrated Development environments described above are best-in-class, and have free versions that will work fine for the EPI Judge. They do not include the compilers. You can get the Java development environment from [Oracle](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), and the Python development environment from [Python.org](https://www.python.org/downloads/). For C++, you have multiple options. The simplest is to install [VisualStudio](https://code.visualstudio.com/download), which includes both the IDE and the compiler. Google is a good resource for installation help.
- How do I import the C++ project?

- How can I understand the test framework better?
If you want to import the project into your favourite IDE, you probably need to create IDE project with [CMake](https://cmake.org/) (no need to do it for CLion, it supports CMake out-of-the-box).

The judge harness is fairly complex (but does not use nonstandard language features or libraries). You are welcome to study it, but we’d advise you against making changes to it (since it will lead to nasty merge conflicts when you update).
Here is an example recipe for generationg Visual Studio project ([list](https://cmake.org/cmake/help/v3.10/manual/cmake-generators.7.html) of all CMake supported IDEs).
After installing CMake, open your terminal, go to `epi_judge_cpp` folder and run following commands:

mkdir vs
cd vs
cmake -G "Visual Studio 15 2017" ..

Then just open `epi_judge_cpp/vs/epi_judge_cpp.sln` solution with Visual Studio and it will load all EPI programs.

## Problem to Program Mapping

Expand Down Expand Up @@ -249,6 +249,7 @@ The judge harness is fairly complex (but does not use nonstandard language featu
| Compute the LCA in a BST | lowest\_common\_ancestor\_in\_bst.cc | LowestCommonAncestorInBst.java | lowest\_common\_ancestor\_in\_bst.py |
| Reconstruct a BST from traversal data | bst\_from\_preorder.cc | BstFromPreorder.java | bst\_from\_preorder.py |
| Find the closest entries in three sorted arrays | minimum\_distance\_3\_sorted\_arrays.cc | MinimumDistance3SortedArrays.java | minimum\_distance\_3\_sorted\_arrays.py |
| Enumerate numbers of the form a + b * sqrt(2) | a\_b\_sqrt2.cc | ABSqrt2.java | a\_b\_sqrt2.py |
| Build a minimum height BST from a sorted array | bst\_from\_sorted\_array.cc | BstFromSortedArray.java | bst\_from\_sorted\_array.py |
| Test if three BST nodes are totally ordered | descendant\_and\_ancestor\_in\_bst.cc | DescendantAndAncestorInBst.java | descendant\_and\_ancestor\_in\_bst.py |
| Add credits | adding\_credits.cc | AddingCredits.java | adding\_credits.py |
Expand Down Expand Up @@ -281,9 +282,10 @@ The judge harness is fairly complex (but does not use nonstandard language featu
| The 3-sum problem | three\_sum.cc | ThreeSum.java | three\_sum.py |
| Find the majority element | majority\_element.cc | MajorityElement.java | majority\_element.py |
| The gasup problem | refueling\_schedule.cc | RefuelingSchedule.java | refueling\_schedule.py |
| Compute the maximum water trapped by a pair of vertical lines | max\_trapped\_water.cc | MaxTrappedWater.java | max\_trapped\_water.py |
| Compute the largest rectangle under the skyline | largest\_rectangle\_under\_skyline.cc | LargestRectangleUnderSkyline.java | largest\_rectangle\_under\_skyline.py |
| Search a maze | search\_maze.cc | SearchMaze.java | search\_maze.py |
| Paint a Boolean Matrix | matrix_connected_regions.cc | MatrixConnectedRegions.java | matrix_connected_regions.py |
| Paint a Boolean Matrix | matrix\_connected\_regions.cc | MatrixConnectedRegions.java | matrix\_connected\_regions.py |
| Compute enclosed regions | matrix\_enclosed\_regions.cc | MatrixEnclosedRegions.java | matrix\_enclosed\_regions.py |
| Deadlock detection | deadlock\_detection.cc | DeadlockDetection.java | deadlock\_detection.py |
| Clone a graph | graph\_clone.cc | GraphClone.java | graph\_clone.py |
Expand All @@ -307,7 +309,7 @@ The judge harness is fairly complex (but does not use nonstandard language featu
| Search a sorted array of unknown length | search\_unknown\_length\_array.cc | SearchUnknownLengthArray.java | search\_unknown\_length\_array.py |
| Search in two sorted arrays | kth\_largest\_element\_in\_two\_sorted\_arrays.cc | KthLargestElementInTwoSortedArrays.java | kth\_largest\_element\_in\_two\_sorted\_arrays.py |
| Find an element that appears only once | element\_appearing\_once.cc | ElementAppearingOnce.java | element\_appearing\_once.py |
| Find the line through the most points | line\_though\_most\_points.cc | LineThoughMostPoints.java | line\_though\_most\_points.py |
| Find the line through the most points | line\_through\_most\_points.cc | LineThroughMostPoints.java | line\_through\_most\_points.py |
| Convert a sorted doubly linked list into a BST | sorted\_list\_to\_bst.cc | SortedListToBst.java | sorted\_list\_to\_bst.py |
| Convert a BST to a sorted doubly linked list | bst\_to\_sorted\_list.cc | BstToSortedList.java | bst\_to\_sorted\_list.py |
| Merge two BSTs | bst\_merge.cc | BstMerge.java | bst\_merge.py |
Expand All @@ -326,3 +328,8 @@ The judge harness is fairly complex (but does not use nonstandard language featu
| Find the longest subarray whose sum <= k | longest\_subarray\_with\_sum\_constraint.cc | LongestSubarrayWithSumConstraint.java | longest\_subarray\_with\_sum\_constraint.py |
| Road network | road\_network.cc | RoadNetwork.java | road\_network.py |
| Test if arbitrage is possible | arbitrage.cc | Arbitrage.java | arbitrage.py |

## Acknowledgments

A big shout-out to the hundreds of users who tried out the release over the past couple of months. As always, we never fail to be impressed by the enthusiasm and commitment our readers have; it has served to bring out the best in us.
We all thank [Viacheslav Kroilov](https://github.com/metopa), for applying his exceptional software engineering skills to make EPI Judge a reality.
7 changes: 5 additions & 2 deletions epi_judge_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ project(epi_judge_cpp)

set(CMAKE_CXX_STANDARD 14)

if (WIN32)
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4018 -wd4800 -wd4805)
else()
link_libraries(pthread)
endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(a_b_sqrt2 a_b_sqrt2.cc)
add_executable(absent_value_array absent_value_array.cc)
add_executable(adding_credits adding_credits.cc)
add_executable(advance_by_offsets advance_by_offsets.cc)
Expand Down Expand Up @@ -60,6 +61,7 @@ add_executable(gcd gcd.cc)
add_executable(graph_clone graph_clone.cc)
add_executable(gray_code gray_code.cc)
add_executable(group_equal_entries group_equal_entries.cc)
add_executable(h_index h_index.cc)
add_executable(hanoi hanoi.cc)
add_executable(huffman_coding huffman_coding.cc)
add_executable(insert_in_list insert_in_list.cc)
Expand Down Expand Up @@ -96,7 +98,7 @@ add_executable(kth_node_in_tree kth_node_in_tree.cc)
add_executable(largest_rectangle_under_skyline largest_rectangle_under_skyline.cc)
add_executable(left_right_justify_text left_right_justify_text.cc)
add_executable(levenshtein_distance levenshtein_distance.cc)
add_executable(line_though_most_points line_though_most_points.cc)
add_executable(line_through_most_points line_through_most_points.cc)
add_executable(list_cyclic_right_shift list_cyclic_right_shift.cc)
add_executable(longest_contained_interval longest_contained_interval.cc)
add_executable(longest_increasing_subarray longest_increasing_subarray.cc)
Expand All @@ -120,6 +122,7 @@ add_executable(max_safe_height max_safe_height.cc)
add_executable(max_square_submatrix max_square_submatrix.cc)
add_executable(max_submatrix max_submatrix.cc)
add_executable(max_teams_in_photograph max_teams_in_photograph.cc)
add_executable(max_trapped_water max_trapped_water.cc)
add_executable(max_water_trappable max_water_trappable.cc)
add_executable(maximum_subarray_in_circular_array maximum_subarray_in_circular_array.cc)
add_executable(minimum_distance_3_sorted_arrays minimum_distance_3_sorted_arrays.cc)
Expand Down
Loading

0 comments on commit c7ecb08

Please sign in to comment.