laithshadeed / EPIJudge

EPI Judge - Preview Release

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EPI Judge


EPI Judge consists of the following:

  • Stub programs for each problem in our book in Python, Java, and C++
  • Test-cases that cover common corner-case and performance bugs
  • A framework for running these tests on your implementation on your machine


Here's how to download the judge:

$ git clone

If you do not have git, here's a good tutorial on installing git itself.

Running the judge using IDEs

Check out these one minute videos to see how easy it is to get started with the judge.


PyCharm, Eclipse, NetBeans


IntelliJ IDEA, Eclipse


CLion, Visual Studio 2017

Running the judge from the command line


$ python3 <program_name>.py


Use the Makefile.

Compile and run a specific program:

$ make <program_name> 


$ make Anagrams

Compile and run the last program that you edited:

$ make


You can manually compile and run all programs by directly invoking GCC and Clang.

$ g++ -pthread -std=c++14 -O3 -o anagrams

You can also use the provided Makefile: make <program_name>. You can also use CMake with the provided CMakeLists.txt file.

$ make 

The default Makefile target is the last edited file.

$ make anagrams


  • How can I contact the authors?

Please feel free to send us questions and feedback - and

  • Help, my EPIJudge is not working, what should I do?

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.

  • I'm new to programming, and don't have any kind of development environment, what should I do?

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, and the Python development environment from For C++, you have multiple options. The simplest is to install VisualStudio, which includes both the IDE and the compiler. Google is a good resource for installation help.

  • What compilers are supported for judge?

    • C++
      • Linux
        • GCC 5.4.1
        • Clang 4.0
      • OS X
        • Apple LLVM Clang 9.0.0
      • Windows
        • Visual Studio 2017 15.7.0 Preview 6
          • Release version of VS2017 contains a bug that makes it impossible to compile judge programs
        • MinGW GCC 5.4.0
        • LXSS (Windows Subsystem for Linux) GCC 5.4.0
    • Java
      • Java 9
    • Python
      • Python 3.6
  • What compilers are supported for solutions?

    • C++
      • Linux
        • GCC 7.0.0
        • Clang 5.0
      • OS X
        • Apple LLVM Clang 9.0.0
      • Windows
        • Visual Studio 2017 15.7.0 Preview 6
          • Release version of VS2017 contains a bug that makes it impossible to compile judge programs
        • MinGW GCC 7.2.0
        • LXSS (Windows Subsystem for Linux) GCC 7.2.0
      • Java
        • Java 9
      • Python
        • Python 3.6

Let us know if you managed to compile with an older version.

  • What does the UI look like?

Take a look at this screenshot.

  • How can I understand the test framework better?

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

  • How do I import the C++ project?

If you want to import the project into your favourite IDE, you probably need to create IDE project with CMake (no need to do it for CLion, it supports CMake out-of-the-box).

Here is an example recipe for generationg Visual Studio project (list 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

(You may have to scroll to the right to view the Python column.)

Problem C++ Java Python
Bootcamp: Primitive Types
Computing the parity of a word
Swap bits
Reverse bits
Find a closest integer with the same weight
Compute x * y without arithmetical operators
Compute x/y
Compute x^y
Reverse digits
Check if a decimal integer is a palindrome
Generate uniform random numbers
Rectangle intersection
Bootcamp: Arrays
The Dutch national flag problem
Increment an arbitrary-precision integer
Multiply two arbitrary-precision integers
Advancing through an array
Delete duplicates from a sorted array
Buy and sell a stock once
Buy and sell a stock twice
Computing an alternation
Enumerate all primes to n
Permute the elements of an array
Compute the next permutation
Sample offline data
Sample online data
Compute a random permutation
Compute a random subset
Generate nonuniform random numbers
The Sudoku checker problem
Compute the spiral ordering of a 2D array
Rotate a 2D array
Compute rows in Pascal's Triangle
Interconvert strings and integers
Base conversion
Compute the spreadsheet column encoding
Replace and remove
Test palindromicity
Reverse all the words in a sentence
Compute all mnemonics for a phone number
The look-and-say problem
Convert from Roman to decimal
Compute all valid IP addresses
Write a string sinusoidally
Implement run-length encoding
Find the first occurrence of a substring
Bootcamp: Linked Lists
Bootcamp: Linked Lists
Bootcamp: Linked Lists
Merge two sorted lists
Reverse a single sublist
Test for cyclicity
Test for overlapping lists - lists are cycle-free
Test for overlapping lists - lists may have cycles
Delete a node from a singly linked list
Remove the kth last element from a list
Remove duplicates from a sorted list
Implement cyclic right shift for singly linked lists
Implement even-odd merge
Test whether a singly linked list is palindromic
Implement list pivoting
Add list-based integers
Implement a stack with max API
Evaluate RPN expressions
Test a string over ''{,},(,),[,]'' for well-formedness
Normalize pathnames
Compute buildings with a sunset view
Compute binary tree nodes in order of increasing depth
Implement a circular queue
Implement a queue using stacks
Implement a queue with max API
Test if a binary tree is height-balanced
Test if a binary tree is symmetric
Compute the lowest common ancestor in a binary tree
Compute the LCA when nodes have parent pointers
Sum the root-to-leaf paths in a binary tree
Find a root to leaf path with specified sum
Implement an inorder traversal without recursion
Implement a preorder traversal without recursion
Compute the kth node in an inorder traversal
Compute the successor
Implement an inorder traversal with O(1) space
Reconstruct a binary tree from traversal data
Reconstruct a binary tree from a preorder traversal with markers
Form a linked list from the leaves of a binary tree
Compute the exterior of a binary tree
Compute the right sibling tree
Merge sorted files
Sort an increasing-decreasing array
Sort an almost-sorted array
Compute the k closest stars
Compute the median of online data
Compute the k largest elements in a max-heap
Search a sorted array for first occurrence of k
Search a sorted array for entry equal to its index
Search a cyclically sorted array
Compute the integer square root
Compute the real square root
Search in a 2D sorted array
Find the min and max simultaneously
Find the kth largest element
Find the missing IP address
Find the duplicate and missing elements
Bootcamp: Hash Tables
Test for palindromic permutations
Is an anonymous letter constructible?
Implement an ISBN cache
Compute the LCA, optimizing for close ancestors
Find the nearest repeated entries in an array
Find the smallest subarray covering all values
Find smallest subarray sequentially covering all values
Find the longest subarray with distinct entries
Find the length of a longest contained interval
Compute all string decompositions
Test the Collatz conjecture
Compute the intersection of two sorted arrays
Merge two sorted arrays
Computing the h-index
Remove first-name duplicates
Smallest nonconstructible value
Render a calendar
Merging intervals
Compute the union of intervals
Partitioning and sorting an array with many repeated entries
Team photo day - 1
Implement a fast sorting algorithm for lists
Compute a salary threshold
Test if a binary tree satisfies the BST property
Find the first key greater than a given value in a BST
Find the k largest elements in a BST
Compute the LCA in a BST
Reconstruct a BST from traversal data
Find the closest entries in three sorted arrays
Enumerate numbers of the form a + b sqrt(2)
Build a minimum height BST from a sorted array
Test if three BST nodes are totally ordered
The range lookup problem
Add credits
The Towers of Hanoi problem
Generate all nonattacking placements of n-Queens
Generate permutations
Generate the power set
Generate all subsets of size k
Generate strings of matched parens
Generate palindromic decompositions
Generate binary trees
Implement a Sudoku solver
Compute a Gray code
Bootcamp: Dynamic Programming
Bootcamp: Dynamic Programming
Count the number of score combinations
Compute the Levenshtein distance
Count the number of ways to traverse a 2D array
Compute the binomial coefficients
Search for a sequence in a 2D array
The knapsack problem
The problem
Find the minimum weight path in a triangle
Pick up coins for maximum gain
Count the number of moves to climb stairs
The pretty printing problem
Find the longest nondecreasing subsequence
Compute an optimum assignment of tasks
Schedule to minimize waiting time
The interval covering problem
The interval covering problem
The 3-sum problem
Find the majority element
The gasup problem
Compute the maximum water trapped by a pair of vertical lines
Compute the largest rectangle under the skyline
Search a maze
Paint a Boolean matrix
Compute enclosed regions
Deadlock detection
Clone a graph
Making wired connections
Transform one string to another
Team photo day - 2
Compute the greatest common divisor
Find the first missing positive entry
Buy and sell a stock k times
Compute the maximum product of all entries but one
Compute the longest contiguous increasing subarray
Rotate an array
Identify positions attacked by rooks
Justify text
Implement list zipping
Copy a postings list
Compute the longest substring with matching parens
Compute the maximum of a sliding window
Implement a postorder traversal without recursion
Compute fair bonuses
Search a sorted array of unknown length
Search in two sorted arrays
Find the kth largest element - large n, small k
Find an element that appears only once
Find the line through the most points
Convert a sorted doubly linked list into a BST
Convert a BST to a sorted doubly linked list
Merge two BSTs
Implement regular expression matching
Synthesize an expression
Count inversions
Draw the skyline
Measure with defective jugs
Compute the maximum subarray sum in a circular array
Determine the critical height
Find the maximum 2D subarray
Find the maximum 2D subarray
Implement Huffman coding
Trapping water
The heavy hitter problem
Find the longest subarray whose sum <= k
Road network
Test if arbitrage is possible


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, for applying his exceptional software engineering skills to make EPI Judge a reality.


EPI Judge - Preview Release



Language:C++ 34.4%Language:Java 27.6%Language:Python 25.7%Language:Makefile 9.2%Language:JavaScript 2.4%Language:CMake 0.7%Language:C 0.0%