Arnab Chakraborty has Published 4452 Articles

Program to sort array by increasing frequency of elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 13:07:55

2K+ Views

Suppose we have an array with some elements where elements may appear multiple times. We have to sort the array such that elements are sorted according to their increase of frequency. So which element appears less number of time will come first and so on.So, if the input is like ... Read More

Program to find largest substring between two equal characters in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 13:07:36

179 Views

Suppose we have a string s, we have to find the length of the longest substring between two equal letters or elements, excluding the two characters. If we cannot find such substring, then return -1.So, if the input is like s = "level", then the output will be 3 as ... Read More

Program to find mean of array after removing some elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 13:07:17

192 Views

Suppose we have array called nums, we have to find the mean of the remaining values after removing the smallest 5% and the largest 5% of the elements.So, if the input is like nums = [2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ... Read More

Program to find X for special array with X elements greater than or equal X in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 13:05:12

368 Views

Suppose we have an array called nums where all elements are either 0 or positive. The nums is considered special array if there exists a number x such that there are exactly x numbers in nums which are larger than or equal to x. And x does not have to ... Read More

Program to design parking system in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 13:02:23

2K+ Views

Suppose you want to design a parking system. A parking lot has three different kinds of parking spaces − big, medium, and small. And there are fixed number of slots for each size. Make a class called OurParkingSystem with of two methods −constructor(big, medium, small) − This constructor is taking ... Read More

Program to find minimum jump needed to return from a folder to home in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 13:01:57

246 Views

Suppose we have a logs where we have path to enter into folders, there may be different symbols like −"../" : Move to the parent folder from current one. (If we are at main folder, do not change location)."./" : Remain in the current folder."x/" : Move to the child ... Read More

Program to rearrange spaces between words in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 13:01:33

338 Views

Suppose we have a string s with some words that are placed among some number of spaces. Each words are separated by at least one space. We have to rearrange the spaces so that there are same number of spaces between every pair of adjacent words and the number of ... Read More

Program to find sum of all odd length subarrays in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 13:01:13

417 Views

Suppose we have an array of positive values called nums, we have to find the sum of all possible odd-length subarrays. As we know a subarray is a contiguous subsequence of the array. We have to find the sum of all odd-length subarrays of nums.So, if the input is like ... Read More

Program to find number of special positions in a binary matrix using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 13:00:44

245 Views

Suppose we have a binary matrix of order m x n, we have to find the number of special positions in the matrix. A position (i, j) is a special position when mat[i, j] = 1 and all other elements in row i and column j are 0.So, if the ... Read More

Program to replace all question symbols to avoid consecutive repeating characters in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-May-2021 12:53:59

292 Views

Suppose we have a lowercase string s that contains only letters and '?' character, we have to convert all '?' characters into lower case letters such that the final string will not have any consecutive repeating characters. If there is more than one solution, return any of them.So, if the ... Read More

Advertisements