Arnab Chakraborty has Published 4293 Articles

Program to find second largest digit in a string using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:31:05

1K+ Views

Suppose we have an alphanumeric string s, we have to find the second largest numerical digit that appears in s, if there is no such string then return -1.So, if the input is like s = "p84t3ho1n", then the output will be 4 as the digits are [1, 3, 4, ... Read More

Program to find maximum ascending subarray sum using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:30:50

629 Views

Suppose we have an array of positive values called nums, we have to find the maximum possible sum of an ascending subarray in nums. We can say a subarray [nums_l, nums_l+1, ..., nums_r-1, nums_r] is ascending when for all i where l nums[i-1], thentotal := total + nums[i]otherwise, total:= ... Read More

Program to find number of different integers in a string using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:17:19

406 Views

Suppose we have a lowercase alphanumeric string s. We shave to replace every non-digit character with a space, but now we are left with some integers that are separated by at least one space. We have to find the number of different integers after performing the replacement operations on s. ... Read More

Program to determine color of a chessboard square using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:17:01

2K+ Views

Suppose we have a chessboard coordinate, that is a string that represents the coordinates of row and column of the chessboard. Below is a chessboard for your reference.We have to check whether given cell is white or not, if white return true, otherwise return false.So, if the input is like ... Read More

Program to find k partitions after truncating sentence using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:16:46

115 Views

Suppose we have sentence s where some English words are present, that are separated by a single space with no leading or trailing spaces. We also have another value k. We have to find only the first k words after truncating.So, if the input is like s = "Coding challenges ... Read More

Program to find sign of the product of an array using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:16:31

235 Views

Suppose we have an array called nums. We have to find sign of the multiplication result of all elements present in the array.So, if the input is like nums = [-2, 3, 6, -9, 2, -4], then the output will be Negative, as the multiplication result is -2592To solve this, ... Read More

Program to find minimum operations to make the array increasing using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:16:17

496 Views

Suppose we have an array nums. In one operation, we can select one element of the array and increase it by 1. For example, if we have [4, 5, 6], we can select element at index 1 to make the array [4, 5, 5]. Then we have to find the ... Read More

Program to find sum of digits in base K using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:15:44

715 Views

Suppose we have a number n in decimal number system (base 10) have another value k, we have to find the sum of the digits of n after converting given number n from base 10 to base k. When we calculate digit sum, we will consider each digit as decimal ... Read More

Program to find largest perimeter triangle using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:14:25

558 Views

Suppose we have an array nums of positive lengths, we have to find the largest perimeter of a triangle, by taking three values from that array. When it is impossible to form any triangle of non-zero area, then return 0.So, if the input is like [8, 3, 6, 4, 2, ... Read More

Program to replace all digits with characters using Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-May-2021 14:11:15

3K+ Views

Suppose we have an alphanumeric string s that contains lowercase English letters in its even positions and digits in its odd positions. Consider an operation shift(c, x), where c is any character and x is a number (digit), this will find the xth character after c. So, for example, shift('p', ... Read More

Advertisements