Hafeezul Kareem has Published 328 Articles

N-th root of a number in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 22-Oct-2021 07:38:31

884 Views

You are given the N-th root and the result of it. You need to find the number such that numberN = result.Let's see some examples.Input result = 25 N = 2Output 5The 52 = 25. Hence the output in the above example is 5.Inputresult = 64 N = 3Output4 The ... Read More

N-th polite number in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 22-Oct-2021 06:54:46

221 Views

A polite number is a positive number that can be written as the sum of 2 or more consecutive positive numbers.The series of polite numbers are3 5 6 7 9 10 11 12 13 14...There exists a formula to find the n-th polite number. The formula is n + log2(n ... Read More

n-th number with digits in {0, 1, 2, 3, 4, 5} in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 22-Oct-2021 06:33:37

341 Views

The numbers formed with the digits {0, 1, 2, 3, 4, 5} are0, 1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 25, etc.., We can form the above sequence using the first 6 digits. Let's see an example of the formation of ... Read More

n-th number whose sum of digits is ten in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 22-Oct-2021 06:08:19

355 Views

The numbers whose digits sum is equal to 10 are19, 28, 37, 46, 55, 64, 73, 82, 91, etc.., If you observe the series, each number is incremented by 9. There are numbers in the above sequence whose digits sum does not equal 10 while incrementing by 9. But, you ... Read More

N-th multiple in sorted list of multiples of two numbers in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 22-Oct-2021 05:54:52

212 Views

You are given three numbers. You need to find the n-th multiple from the multiples of the first two numbers. Let's see an example to understand it more clearly.Input x = 2 y = 3 n = 7Output 10The first n ****multiples of 2 are 2 4 6 8 10 ... Read More

N digit numbers divisible by 5 formed from the M digits in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 21-Oct-2021 12:57:36

199 Views

We have given a number N along with an array of M digits. Our job is to find the number of n digit numbers formed from the given M digits that are divisible by 5.Let's see some examples to understand the problem inputs and outputs.In − N = 2 M ... Read More

Latin Square in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 21-Oct-2021 09:12:56

551 Views

The Latin square is a matrix that has a special pattern. Let's see different examples to examine the pattern.1 2 2 1 1 2 3 3 1 2 2 3 1 1 2 3 4 4 1 2 3 3 4 1 2 2 3 4 1 ... Read More

Permutation of a given string using the inbuilt function in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 16-Apr-2021 19:44:10

3K+ Views

In this tutorial, we are going to find the permutation of a string using the inbuilt function of Python called permutations. The method permutations is present in the itertools module.Procedure To Find The Permutation Of A StringImport the itertools module.Initialize the string.Use the itertools.permutations method to find the permutation of the string.In the ... Read More

Largest subarray with equal number of 0s and 1s in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 09-Apr-2021 14:14:28

190 Views

Let's see the steps to complete the program.Initialise the array.Make all zeroes in the array to -1.Have a map an empty map to store the previous indexes.Initialise sum to 0, max length to 0 and ending index to -1.Write a loop that iterates till n.Add current element to sum.If the ... Read More

Largest sum subarray with at-least k numbers in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 09-Apr-2021 14:06:53

394 Views

Let's see the steps to complete the program.Initialise the array.Initialise max_sum array of size n.Find the max sum for every index and store it in max_sum array.Compute the sum of all the elements and store it in a variable sum.Write a loop that iterates from i = k to n.Add ... Read More

Previous 1 ... 6 7 8 9 10 ... 33 Next
Advertisements