Arnab Chakraborty has Published 4452 Articles

Program to find sum of concatenated pairs of all each element in a list in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:41:57

474 Views

Suppose we have a list of numbers called nums. We have to find the sum of every concatenation of every pair of numbers in nums. Here the pair (i, j) and pair (j, i) are considered different.So, if the input is like nums = [5, 3], then the output will ... Read More

Program to find length of concatenated string of unique characters in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:36:22

197 Views

Suppose we have a list of strings words. We have to make a string that is constructed by concatenating a subsequence of words such that each letter is unique. We have to finally find the length of the longest such concatenation.So, if the input is like words = ["xyz", "xyw", ... Read More

Program to find minimum number of groups in communication towers in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:33:18

141 Views

Suppose we have a 2D binary matrix where 1 represents a communication tower, and 0 represents an empty cell. The towers can communicate in the following ways: 1. If tower A, and tower B are either on the same row or column, they can communicate with each other. 2. If ... Read More

Program to find angle between hour and minute hands of a clock in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:26:28

2K+ Views

Suppose we have two values hours and minutes. We have to find a smaller angle formed between the hour and the minute hand.So, if the input is like hour = 12 minutes = 45, then the output will be 112.5To solve this, we will follow these steps:if h = 12, ... Read More

Program to find maximum number of courses we can take based on interval time in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:24:08

168 Views

Suppose we have a list of intervals in the form [start, end], this is representing the start and end time of a course. We have to find the maximum number of courses we can take, assuming we can only take one course at a time and the start of a ... Read More

Program to find number of boxes that form longest chain in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:21:39

145 Views

Suppose we have a list of boxes, here each entry has two values [start, end] (start < end). We can join two boxes if the end of one is equal to the start of another. We have to find the length of the longest chain of boxes.So, if the input ... Read More

Program to check whether first player win in candy remove game or not in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:17:11

125 Views

Suppose we have a list of numbers called candies and someone is playing a game against his/her friend. In each round, a player can remove any two consecutive candies with the same value. And whoever can not pick up a candy loses and that player1 start first, we have to ... Read More

Program to evaluate Boolean expression from a string in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:15:08

693 Views

Suppose we have a string s containing a boolean expression with operators "and" and "or", evaluate it and return the result. Here the expressions may have parentheses, which should be evaluated first.So, if the input is like s = "T and (F or T)", then the output will be TrueTo ... Read More

Program to find minimum bus fare for travelling all days in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:10:37

765 Views

Suppose we have a list of sorted numbers called days, where we must take the bus for on each day. We have to find the lowest cost it takes to travel for all the days. There are 3 types of bus tickets. 1-day pass for 2 bucks 7-day pass for ... Read More

Program to count number of swaps required to change one list to another in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:07:36

316 Views

Suppose we have two lists of numbers L1 and L2, the length of each list is n and each value is unique to its list, and values are in range 1 to n, we have to find the minimum number of adjacent swaps required to transform L1 to L2.So, if ... Read More

Advertisements