Arnab Chakraborty has Published 3734 Articles

Program to find nth term of a sequence which are divisible by a, b, c in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:17:05

428 Views

Suppose we have four numbers n, a, b, and c. We have to find the nth (0 indexed) term of the sorted sequence of numbers divisible by a, b or c.So, if the input is like n = 8 a = 3 b = 7 c = 9, then the ... Read More

Program to find length of the largest subset where one element in every pair is divisible by other in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:13:56

390 Views

Suppose we have a list of unique numbers called nums, so we have to find the largest subset such that every pair of elements in the subset like (i, j) satisfies either i % j = 0 or j % i = 0. So we have to find the size ... Read More

Program to find number of sublists that contains exactly k different words in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:11:43

152 Views

Suppose we have a list of words and another value k. We have to find the number of sublists in the given words such that there are exactly k different words.So, if the input is like words = ["Kolkata", "Delhi", "Delhi", "Kolkata"] k = 2, then the output will be ... Read More

Program to find how long it will take to reach messages in a network in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:09:08

214 Views

Suppose we have a number and a list of edges. These n different nodes labeled as 0 to N. These nodes are forming a network. Each edge is in the form (a, b, t) of an undirected graph, this is representing if we try to send message from a to ... Read More

Program to find number of steps required to change one word to another in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:08:44

292 Views

Suppose we have a list of words called dictionary and we have another two strings start and end. We want to reach from start to end by changing one character at a time and each resulting word should also be in the dictionary. Words are case-sensitive. So we have to ... Read More

Program to check whether odd length cycle is in a graph or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:02:11

510 Views

Suppose we have an undirected graph we have to check whether we can find an odd length cycle inside it or not.So, if the input is like adj_list = [[1, 2], [0, 3, 4], [0, 3, 4], [1, 2, 4], [1, 2, 3]]then the output will be True as there ... Read More

Program to get indices of a list after deleting elements in ascending order in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 08:58:42

230 Views

Suppose we have a list of distinct values and we want to remove each number in non-decreasing order. We have to find the indices of numbers in order of their deletion.So, if the input is like nums = [4, 6, 2, 5, 3, 1], then the output will be [5, ... Read More

Program to check number of requests that will be processed with given conditions in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 06:05:58

513 Views

Suppose we have a list of requests where each list contains elements like [uid, time_sec] (uid is the user id and time_sec is the timestamp). This indicates the user whose id is uid has requested to a website at timestamp time_sec. We also have two values u and g where ... Read More

Program to check some elements in matrix forms a cycle or not in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 06:04:32

258 Views

Suppose we have a 2d matrix. We have to check whether we can start from some cell then move adjacent cells (up, down, left, right) of the same value, and come back to the same starting point. We cannot revisit a cell that we have visited last.So, if the input ... Read More

Program to count how many ways we can cut the matrix into k pieces in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 06:01:58

266 Views

Suppose we have a binary matrix and another value k. You want to split the matrix into k pieces such that each piece contains at least one 1 in it. But there are some rules for cutting, we have to follow in order: 1. Select a direction: vertical or horizontal ... Read More

Advertisements