Arnab Chakraborty has Published 4293 Articles

C++ program to calculate how many years needed to get X rupees with 1% interest

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:37:50

178 Views

Suppose we have a number X. We have 100 rupees in a bank. The bank returns annual interest rate of 1 % compounded annually. (Integers only). We have to check how many years we need to get X rupees?So, if the input is like X = 520, then the output ... Read More

C++ program to find number of distinct values we can get after negating a subarray

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:33:05

225 Views

Suppose we have an array A with n elements. We select any subset of given numbers and negate these numbers. We have to find maximum number of different values in the array we can get.So, if the input is like A = [1, 1, 2, 2], then the output will ... Read More

C++ program to count expected number of operations needed for all node removal

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:28:50

191 Views

Suppose we have the adjacency matrix of a directed graph G. Until the graph becomes empty, we are repeating the following operation: Select one vertex from G, then erase that vertex and all vertices that are reachable from that vertex by following some edges. Erasing a vertex will also erase ... Read More

C++ program to find n valid bracket sequences

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:28:11

469 Views

Suppose we have a number n. As we know, a bracket sequence is a string containing only characters "(" and ")". A valid bracket sequence is a bracket sequence which can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the ... Read More

C++ program to find fourth side of a quadrilateral

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:24:58

276 Views

Suppose we have three numbers a, b and c. We want to make a closed fence in a shape of arbitrary non-degenerate simple quadrilateral. We already have three sides of length a, b and c. We have to find another side d.So, if the input is like a = 12; ... Read More

C++ program to find range whose sum is same as n

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:22:36

195 Views

Suppose we have a number n. We need to find two integers l and r, such that l < r and l + (l + 1) + ... + (r - 1) + r = n.So, if the input is like n = 25, then the output will be l ... Read More

C++ program to count number of dodecagons we can make of size d

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:22:22

144 Views

Suppose we have a number d. Consider there is an infinite number of square tiles and regular triangular tiles with sides length 1. We have to find in how many ways we can form regular dodecagon (12-sided polygon) with sides d using these tiles. If the answer is too large, ... Read More

C++ program to find circumference of the circular pond with radius R

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:17:43

118 Views

Suppose we have a number R, represents the radius of a pond. We have to find the circumference of this pond.So, if the input is like R = 73, then the output will be 458.67252742410977361942StepsTo solve this, we will follow these steps −res := r * 2 * cos-inverse (-1) ... Read More

C++ program to find string after adding character 'a' string becomes non-palindrome

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:17:30

157 Views

Suppose we have a string S with lowercase English letters. We must insert exactly one character 'a' in S. After inserting that if we can make S not a palindrome then return that string, otherwise return "impossible".So, if the input is like S = "bpapb", then the output will be ... Read More

C++ program to convert kth character to lowercase

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:15:49

210 Views

Suppose we have a string S with N characters. S contains only three types of characters 'A', 'B' or 'C'. We also have another integer K. We have to print S after lowercasing the Kth character in it.So, if the input is like K = 2; S = "AABACC", then ... Read More

Advertisements