Arnab Chakraborty has Published 3734 Articles

Program to find number of optimal steps needed to reach destination by baby and giant steps in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:57:45

446 Views

Suppose we have a list of queries Q, where each query Q[i] contains a triplet [a_i, b_i and d_i]. Consider we are at position (0, 0) initially, then in one step we can move from some position (x1, y1) to (x2, y2) where Euclidean distance between these two points is ... Read More

Program to check all 1s are present one after another or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:55:36

182 Views

Suppose we have a list of numbers called nums that contains at least one element whose value is 1. We have to check whether all the 1s appear consecutively or not.So, if the input is like nums = [8, 2, 1, 1, 1, 3, 5], then the output will be ... Read More

Program to find removed term from arithmetic sequence in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:54:06

275 Views

Suppose we have an array called nums holding n-1 arithmetic sequence terms. One element except the first or last element of nums was removed before. We have to find the removed number.So, if the input is like nums = [5, 7, 11, 13], then the output will be 9 because, ... Read More

Program to find list that shows closest distance of character c from that index in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:47:55

474 Views

Suppose we have a string s and another character c, c must be present in s, we have to find a list whose length is same as length of s where for each index i its value is set the closest distance of s[i] to c.So, if the input is ... Read More

Program to check two spheres can ever meet by accelerating or not in a 3D space in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:47:52

132 Views

Suppose there are two spheres whose radius values are r1 and r2. They are at (x1, y1, z1) and (x2, y2, z2) coordinates. And their acceleration values are given like (ax1, ay1, az1) and (ax2, ay2, az2). We have to check whether these two spheres will ever meet on 3D ... Read More

Program to find sum of digits that are inside one alphanumeric string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:40:39

651 Views

Suppose we have an alphanumeric string s with digits from "0" to "9" and lowercase English letters. We have to find the sum of the numbers that are present in s. If digits are consecutive then consider them into a single number.So, if the input is like s = "hello25world63power86", ... Read More

Program to check we can rearrange array to make difference between each pair of elements same in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:36:04

236 Views

Suppose we have a list called nums, we have to check whether we can rearrange the order of nums in such a way that the difference between every pair of consecutive two numbers is same.So, if the input is like nums = [8, 2, 6, 4], then the output will ... Read More

Program to find the maximum sum of the subarray modulo by m in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:35:17

315 Views

Program to find the maximum sum of the subarray modulo by m in PythonSuppose we have an array nums with n elements. We have another integer m. We have to find the maximum value of sum of any of its subarrays modulo m.So, if the input is like nums = ... Read More

Program to add one to a number that is shown as a digit list in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:21:37

758 Views

Suppose we have an array called nums, containing decimal digits of a number. For example, [2, 5, 6] is for 256. We have to add 1 with this number and return the list in same format as before.So, if the input is like nums = [2, 6, 9], then the ... Read More

Program to count number of 5-star reviews required to reach threshold percentage in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:19:05

857 Views

Suppose we have a list called reviews and a threshold value t. Each item in reviews[i] has [x, y] means product i had x number of 5-star rating and y number of reviews. We have to find the minimum number of additional 5-star reviews we need so that the percentage ... Read More

Advertisements