Arnab Chakraborty has Published 4452 Articles

Program to check subarrays can be rearranged from arithmetic sequence or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 07:09:18

97 Views

Suppose we have sequence of numbers nums, and another two arrays l and r of size m, these l and r are representing range queries like [l[i], r[i]]. We have to find a Boolean sequence ans, where ans[i] is true when the subarray nums[l[i]], nums[l[i] + 1], ... nums[r[i] - ... Read More

Program to split two strings to make palindrome using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2021 14:24:40

404 Views

Suppose we have two strings a and b whose length are same. We have to select an index and split both strings at that selected index, splitting a into two strings: a_pref and a_suff where a = a_pref | a_suff, and splitting b into two strings: b_pref | b_suff (| ... Read More

Program to find out the number of people who get a food packet using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2021 14:09:05

297 Views

Suppose in a conference, there are two types of people. The first type of people prefers a vegetarian lunch, and the other type prefers a non-vegetarian lunch. But there are a limited number of packets, and if the vegetarians receive a non-vegetarian packet or vice versa; they will not take ... Read More

Program to maximize the minimum force between balls in a bucket using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2021 13:38:36

209 Views

Suppose we are given several buckets and x number of balls. If the balls are put into the bucket, a special force acts within them and we have to find out a way to maximize the minimum force between two balls. The force between two balls in a bucket of ... Read More

Program to find array of doubled pairs using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2021 13:28:52

101 Views

Suppose we have an array of called nums whose length is even, we have to check whether it is possible to reorder it in such a way that nums[2*i + 1] = 2*nums[2*i] for every 0 cnt[2 * x], thenreturn Falsecnt[2 * x] := cnt[2 * x] - cnt[x]return ... Read More

Program to find minimum moves to make array complementary in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2021 13:26:17

237 Views

Suppose we have an array nums of even length another value limit. In one move, we can replace any value from nums with another value between 1 and limit, inclusive. The array is said to be complementary if for all indices i, nums[i] + nums[n-1-i] equals the same number. So ... Read More

Program to find the most competitive subsequence in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2021 13:20:01

160 Views

Suppose we have an array nums and another value k, we have to find the most competitive subsequence of nums of size k. Here a subsequence s1 is more competitive than a subsequence s2 (of equal size) if in the first position where s1 and s2 differ, subsequence s1 has ... Read More

Program to merge in between linked lists in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2021 13:11:11

803 Views

Suppose we have two linked lists L1 and L2 of length m and n respectively, we also have two positions a and b. We have to remove nodes from L1 from a-th node to node b-th node and merge L2 in between.So, if the input is like L1 = [1, ... Read More

Program to find ways to make a fair array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2021 12:45:38

270 Views

Suppose we have an array called nums. We can select exactly one index and remove the element from that index. (The index of the elements may change after the removal). We can say an array is fair when the sum of the odd-indexed values equals the sum of the even-indexed ... Read More

Program to find smallest string with a given numeric value in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Oct-2021 12:39:59

313 Views

Suppose we have two values n and k. We have to find the lexicographically smallest string whose length is n and numeric value equal to k. The numeric value of a lowercase character is its position (starting from 1) in the alphabet, so the numeric value of character 'a' is ... Read More

Advertisements