Arnab Chakraborty has Published 4293 Articles

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

99 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 check a number is power of two or not in Python

Arnab Chakraborty

Arnab Chakraborty

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

686 Views

Suppose we have a number n. We have to check whether this is power of 2 or not.So, if the input is like n = 2048, then the output will be True as 2048 is 2^11.To solve this, we will follow these steps −if n is same as 0, thenreturn ... Read More

Program to check number is perfect square or not without sqrt function in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:43:44

3K+ Views

Suppose we have a number n, we have to check whether n is a perfect square number or not. A perfect square number k can be represented as k = a * a for some integer a. We have to solve this without using built-in square root function.So, if the ... 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

587 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

196 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

278 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 find number of different substrings of a string for different queries in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 06:26:59

303 Views

Suppose we have a string s whose length is n. We also have a list of queries Q, where Q[i] contains a pair (l, r). For each query we have to count number of different substrings of s in the inclusive range between l and r.So, if the input is ... Read More

Program to find minimum element addition needed to get target sum in Python

Arnab Chakraborty

Arnab Chakraborty

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

281 Views

Suppose we have list of numbers called nums and another two variables k and t. Let us consider an operation where we choose an element say e in range [-k, k] and insert it to nums at the end. We have to find the minimum number of operations needed so ... 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

720 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

793 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