In sliding window technique, we maintain a window that satisfies the problem constraints. The window is unstable if it violates the problem constraints and it tries stabilize by increasing or decreasing it’s size. Below are some of the problems that uses sliding window technique -
A Topological Sort or Topological Ordering of a directed graph is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering. A topological ordering is possible if and only if the graph has no directed cycles, i.e. if the gra...
Given a M x N binary matrix, fill it with alternating rectangles of 0 and 1.
For example, for a 10 x 8
matrix, output matrix is:
[ 1 1 1 1 1 1 1 1 ]...