Arnab Chakraborty has Published 4452 Articles

Program to count indices pairs for which elements sum is power of 2 in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:31:22

270 Views

Suppose we have a list of numbers called nums. We have to find the number of index pairs i, j, where i < j such that nums[i] + nums[j] is equal to 2^k for some 0 >= k.So, if the input is like nums = [1, 2, 6, 3, 5], ... Read More

Program to check we can get a digit pair and any number of digit triplets or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:28:59

185 Views

Suppose we have a numeric string s. We have to check whether there is some arrangement where we can have one pair of the same character and the rest of the string form any number of triplets of the same characters.So, if the input is like s = "21133123", then ... Read More

Program to check string is palindrome with lowercase characters or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:27:36

636 Views

Suppose we have alphanumeric string s. It can hold both uppercase or lowercase letters. We have to check whether s is a palindrome or not considering only the lowercase alphabet characters.So, if the input is like s = "rLacHEec0a2r8", then the output will be True because the string contains "racecar" ... Read More

Program to find mutual followers from a relations list in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:25:54

162 Views

Suppose we have a list called relations. Where each element in relations list relations[i] contains two numbers [ai, bi] it indicates person ai is following bi on a social media platform. We have to find the list of people who follow someone and they follow them back, we have to ... Read More

Program to find minimum number of monotonous string groups in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:23:33

137 Views

Suppose we have a lowercase string s. We have to find the minimum numbers of contiguous substrings in which s is divided into parts such that each substring is either non-increasing or non-decreasing. So for example, if the string is like "pqqqr" is a non-decreasing string, and "qqqp" is a ... Read More

Program to find minimum value to insert at beginning for all positive prefix sums in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:20:21

153 Views

Suppose we have a list of numbers called nums. We have to find the minimum positive value that we can insert at the beginning of nums so that that prefix sums of the resulting list contains numbers that are all larger than 0.So, if the input is like nums = ... Read More

Program to find minimum distance of two given words in a text in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:18:51

1K+ Views

Suppose we have three strings text, w1, and w2. The text is a sentence with different words. We have to find the smallest distance between any two occurrences of w1 and w2 in the text, the distance is measured in number of words in between them. If either w1 or ... Read More

Program to find minimum amplitude after deleting K elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:16:38

354 Views

Suppose we have a lit of numbers called nums, and have another value k. If we remove k elements from nums, then find the minimum of (maximum of nums - minimum of nums).So, if the input is like nums = [4, 10, 3, 2, 8, 9] k = 3, then ... Read More

Program to find minimum amplitude after deleting KLength sublist in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:15:05

172 Views

Suppose we have a list of numbers called nums and a value k. First we shall remove a sublist of size k, then find the minimum of (maximum of nums - minimum of nums).So, if the input is like nums = [2, 3, 10, 9, 8, 4] k = 3, ... Read More

Program to find maximum number by adding 5 at any place in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Oct-2021 11:12:58

83 Views

Suppose we have a number n, we have to find the maximum number we can get by inserting 5 anywhere in the number.So, if the input is like n = 834, then the output will be 8534.To solve this, we will follow these steps −if n > 0, thens := ... Read More

Advertisements