Arnab Chakraborty has Published 4452 Articles

Program to find reformatted phone number in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 11:44:35

315 Views

Suppose we have a phone number as string. The phone number number consists of digits, spaces and/or dashes '-'. We want to reformat the phone number in a certain manner. There are few rules −Remove all spaces and dashes at beginningGroup the digits from left side to right side into ... Read More

Program to count number of matches played in tournament in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 11:43:25

1K+ Views

Suppose we have a number n. So there are n number of teams in a tournament that has some rules −If the number of teams is even currently, then each team gets merged with another team. And a total of (n/2) matches are played, from them (n/2) winner teams will ... Read More

Program to count the number of consistent strings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 11:42:50

538 Views

Suppose we have a string s consisting of distinct characters and also have an array of strings called words. A string is consistent when all characters in the string appear in the string s. We have to find the number of consistent strings present in the array words.So, if the ... Read More

Program to find goal parser interpretation command in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 11:41:07

379 Views

Suppose we have a Goal Parser that can interpret a given string command. A command consists ofAn alphabet "G", Opening and closing parenthesis "()"and/or "(al)" in some order.Our Goal Parser will interpret "G" as the string "G", "()" as "o", and "(al)" as the string "al". Finally interpreted strings are ... Read More

Python Program to find out the number of sets greater than a given value

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 06:16:33

233 Views

Suppose, we have an array containing several integer numbers. We find out all the contiguous subarrays from the given array of numbers and put it into another list. Now, we replace each subarray with the maximum element in that subarray. There is also a number k given to us, and ... Read More

Python Program to find out the determinant of a given special matrix

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 06:14:42

367 Views

Suppose, we have a tree with n vertices, where each vertex is labeled from 1 to n. The root of the tree has the label 1, and each vertex weights wi. Now a nxn matrix A is formed where A(x, y) = Wf(x, y) where f(x, y) is the least ... Read More

Python Program to find out the number of rooms in which a prize can be hidden

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 06:12:25

385 Views

Suppose, in a game show there are 2n number of rooms that are arranged in a circle. In one of the rooms, there is a prize that the participants have to collect. The rooms are numbered from 1, 2, 3, ...., n, -n, -(n - 1), ...., -1. in a ... Read More

Python Program to find out the sum of values in hyperrectangle cells

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 06:08:42

120 Views

A hyperrectangle is a rectangle that has k dimensions. Each dimension has a length that can be denoted as n1, n2, n3,....., nm. The hyperrectangle's cells are addressed as (p,q,r,...) and contain a value that is equivalent to gcd of (p,q,r,...). Here 1

Python Program to find out how many cubes are cut

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 06:05:19

159 Views

Suppose, there are several cubes of dimensions a, b, and c, and using them a new box of dimension axbxc is created. a, b, and c are pairwise co-prime; gcd(a, b) = gcd(b, c) = gcd(c, d) = 1. We have to cut the box into two pieces with a ... Read More

Python Program to find out how many times the balls will collide in a circular tube

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-May-2021 06:02:48

160 Views

Suppose, there are n balls in a circular tube. The tube is 100 meters long and initially, each ball in the tube is i meters away from a point that we call the starting point. Now the balls start to travel within the tube in a circular order in different ... Read More

Advertisements