Arnab Chakraborty has Published 4452 Articles

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

62 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

105 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

174 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

359 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

128 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 show decimal number from rational number representation in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 08:54:06

313 Views

Suppose we have two numbers called numerator and denominator representing a rational number in the form (numerator / denominator). We have to find its decimal representation as a string. If there are some recurring numbers, then surround them with brackets.So, if the input is like numerator = 164 denominator = ... 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

297 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

150 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

153 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

Program to check whether palindrome can be formed after deleting at most k characters or not in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Dec-2020 05:59:52

446 Views

Suppose we have a string s, we have to check whether we can make this string a palindrome after deleting at most k characters or not.So, if the input is like s = "lieuvrel", k = 4, then the output will be True, we can delete three characters to get ... Read More

Advertisements