Arnab Chakraborty has Published 4293 Articles

Program to find airports in correct order in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:37:21

373 Views

Suppose we have a list of flights as [origin, destination] pairs. The list is shuffled; we have to find all the airports that were visited in the correct order. If there are more than one valid itinerary, return lexicographically smallest ones first.So, if the input is like flights = [["Mumbai", ... Read More

Program to check whether we can make k palindromes from given string characters or not in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:34:02

196 Views

Suppose we have a string s and another number k, we have to check whether we can create k palindromes using all characters in s or not.So, if the input is like s = "amledavmel" k = 2, then the output will be True, as we can make "level" and ... Read More

Program to find minimum number of Fibonacci numbers to add up to n in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:28:33

354 Views

Suppose we have a number n; we have to find the minimum number of Fibonacci numbers required to add up to n.So, if the input is like n = 20, then the output will be 3, as We can use the Fibonacci numbers [2, 5, 13] to sum to 20.To ... Read More

Program to find trailing zeros in factorial of n in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:25:30

204 Views

Suppose we have a number n, we have to find the number of trailing zeros of n!.So, if the input is like n = 20, then the output will be 4, as 20! = 2432902008176640000To solve this, we will follow these stepsset count := 0for i := 5, (n/i) > ... Read More

Program to perform excel spreadsheet operation in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:22:23

369 Views

Suppose we have a 2D matrix representing an excel spreadsheet. We have to find the same matrix with all cells and formulas computed. An excel spreadsheet looks like belowB17035=A1+A2The columns are named as (A, B, C...) and rows are (1, 2, 3....) Each cell will either contain a value, a ... Read More

Program to count number of operations required to convert all values into same in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:18:22

236 Views

Given a list of integers nums, you can perform the following operation: pick the largest number in nums and turn it into the second largest number. Return the minimum number of operations required to make all integers the same in the list.So, if the input is like nums = [5, ... Read More

Program to check whether we can make group of two partitions with equal sum or not in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:16:24

251 Views

Suppose we have a list of numbers called nums, we have to check whether we can partition nums into two groups where the sum of the elements in both groups are same.So, if the input is like nums = [2, 3, 6, 5], then the output will be True, as ... Read More

Program to enclose pattern into bold tag in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:14:34

386 Views

Suppose we have a text and a list of strings called patterns, we have to define an embolden function where all substrings in text that match any string in the given patterns are wrapped in  and  tags. If any two patterns are adjacent or overlap, they should be merged into ... Read More

Program to find number of distinct coin sums we can make with coins and quantities in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:12:25

599 Views

Suppose we have a list of values called coins and another list called quantities of the same length. The value of ith coin is coins[i] and we currently have quantities[i] number of ith coin. We have to find number of distinct coin sum values we can get by using non-empty ... Read More

Program to find a pair (i, j) where nums[i] + nums[j] + (i -j) is maximized in Python?

Arnab Chakraborty

Arnab Chakraborty

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

296 Views

Suppose we have a list of numbers called nums, we have to find a pair (i, j) where i < j, and nums[i] + nums[j] + (i - j) is maximized.So, if the input is like nums = [6, 6, 2, 2, 2, 8], then the output will be 11, ... Read More

Advertisements