Arnab Chakraborty has Published 3734 Articles

Succinct Encoding of Binary Tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 11:11:38

434 Views

Suppose we have a binary tree. As we know the succinct encoding of Binary Tree performs close to lowest possible space. The n’th Catalan number is designated by the number of structurally different binary trees with n different nodes. If the n is large, this is about 4n; thus, we ... Read More

Find the probability of a state at a given time in a Markov chain - Set 1 in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 06:36:52

415 Views

Suppose we have a Markov chain graph g; we have the find the probability to reach the state F at time T if we start from state S when time t = 0. As we know a Markov chain is a random process consisting of various states and the probabilities ... Read More

Find the position of box which occupies the given ball in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 06:34:42

280 Views

Suppose we have two arrays A and B. The size of A is the number of rows and A[i] is the number of boxes in the ith row. And B is the array of balls where B[i] denotes a number on the ball. Given that ball i (value B[i]) will ... Read More

Find the player who rearranges the characters to get a palindrome string first in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 06:33:07

152 Views

Suppose we have a string S with lowercase letters, now two players are playing the game. The rules are as follows −The player wins the game, if, at any move, a player can shuffle the characters of the string to get a palindrome string.The player cannot win when he/she has ... Read More

Find the original matrix when largest element in a row and a column are given in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 06:30:23

261 Views

Suppose we have two arrays A and B of size N and M respectively and we also have one N X M binary matrix where 1 denotes that there was a positive integer in the original matrix and 0 means that position is holding 0 into the original matrix also. ... Read More

Find the ordering of tasks from given dependencies in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 06:28:28

481 Views

Suppose we have n different tasks; these tasks are labeled from 0 to n-1. Some tasks may have prerequisites tasks, so as an example if we want to choose task 2 then we have to first finish the task 1, which is represented as a pair − [2, 1] If ... Read More

Find the number of sub arrays in the permutation of first N natural numbers such that their median is M in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 06:25:09

395 Views

Suppose we have an array A containing the permutation of first N natural numbers and another number M is also given, where M ≤ N, we have to find the number of sub-arrays such that the median of the sequence is M. As we know the median of a sequence ... Read More

Find the number of spectators standing in the stadium at time t in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 06:22:49

141 Views

There are n number of spectators in the stadium, and they are labeled from 1 to n. Now follow these cases −At time t1, the first spectator stands.At time t2, the second spectator stands.…At time tk, the k-th spectator stands.At time tk + 1, the (k + 1)-th spectator stands ... Read More

Find the number of rectangles of size 2x1 which can be placed inside a rectangle of size n x m in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 06:20:52

240 Views

Suppose we have two values n and m; we have to find the number of rectangles of size 2x1 that can be set inside a rectangle of size n x m. There are few conditions, that we have to consider −Any two small rectangles cannot overlap.Every small rectangle lies completely ... Read More

Find the number of distinct pairs of vertices which have a distance of exactly k in a tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 06:17:52

313 Views

Suppose we have an integer k and also have a tree with n nodes, we have to count the number of distinct pairs of vertices which have a exact k distance.So, if the input is like k = 2then the output will be 4To solve this, we will follow these ... Read More

Advertisements