Most recent 8 posts

See also all posts ordered by categories.

Path Statistics

In this article, I talk about this problem (of HackerRank). Try to solve it first!

SymPy vs. SageMath: symbolic computation and automatic differentiation in Python

Get Started

Forming arithmetic expression meeting target value

Given n integers and a target value form an arithmetic expression evaluating to the target value.

Mission improbable

Explanation for the problem mission improbable from the ACM final in 2017. Read the problem statement first.

Lazy segment tree

Maintain a numerical table tab that implements the following operations in logarithmic time: for a range of table indices, query the maximum value, query the minimum value, query the sum, set all entries of that range to some value, add some value to all entries of that range.

Traffic Jam

Given a grid containing some segments, find the minimum number of times segments need to be displaced such that a particular segment can escape from the grid.


Given a boolean formula consisting of Horn clauses, set a minimal number of variables to True in order to satisfy all clauses.

Sprague-Grundy theorem

Given a 2 player impartial game, decide for a given configuration if there is a possibility for the first player to win assuming the second player plays perfectly.