The BFS (Breadth First Search Algorithm) expands the children nodes level by level, which allows you find the shortest distance between source and every other vertices. However, the graph …
Given a two-dimensional integer matrix, sort each of the columns in ascending order. Example 1 Input matrix = , , ] Output , , ] Column Sort In order …
Segment Tree is one of the most important data structure in Computer Science. Similar to Binary Index Tree, a Segment Tree allows us to update and query (range) in …
The FizzBuzz is a famous beginner problem that is often used to start learning a new programming language. Compared to Simple Hello World, the FizzBuzz requires the usage of …
Given strings s0, s1 and a positive integer n, return the nth term of the sequence A where: A = s0 A = s1 A = A + A …
Introduction to Binary Index Tree or Fenwick Tree Binary Index Tree (BIT) aka Fenwick Tree is a simple data structure that has O(LogN) complexity in updating element in a …