Compute and generate a compressed string for a given string containing repetitions
For a given string return a compressed string which replaces all the repetitions of the characters with their counts. If the compressed string is not smaller than the initial string return the original string as it is. For example, if the input string is "aabbbbbcccdddeef", then the resultant string should be "a2b5c3d3e2f1", whereas if the input string is "abcdef" then the output should be "abcdef".
Find all possible natural numbers below a given limit such that a3+b3 = c3+d3
Imagine you are given a number n. You need to find out all possible sets of numbers that fit into a,b,c,d such that a3+b3=c3+d3. There is no restriction that the numbers a,b,c,d need to be distinct.
Find all the pairs in a given ordered set of numbers whose sum is equal to a given input sum
In this problem, we will be given a sorted set of numbers and a number, we need to print all the pairs available in the set whose sum is equal to the given number. For example, if we are given a set of numbers [1,2,5,6,7, 9,11,48,64, 84] and the sum is 8 - the output should be 1,7 2,6 since these are the only "pairs" of numbers which produce the given sum 8 among the numbers in the set.
Find all the pairs in a given unordered set of numbers whose sum is equal to a given input sum
In this problem, we will be given an unordered set of numbers and a number, we need to print all the pairs available in the set whose sum is equal to the given number. For example, if we are given a set of numbers [1, 2, 4, 8, 11, 9, 23, 5, 5, 6] and the sum is 10 - the output should be 8,2 9,1 5,5 6,4 since these are the only "pairs" of numbers which produce the given sum 10 among the numbers in the set.
Sort the given unordered set of Binary digits
In this problem, we shall be given an unordered set of binary digits (0s and 1s) and we are expected to sort all the digits into ascending order. For example, If the given array of digits are [1,0,1,1,0,0,1,1,1,1] the output should be [0,0,0,1,1,1,1,1,1,1].
Print all the possible prime factors for all the numbers till the given limit
Let's assume we are given a number n. we need to print all the numbers till the given number n, such that for every number if there exists a prime factor, we need to print those prime factors instead of that number in the set. For example, if we are given the number as 10. we need to print the output as: 1 2 3 2 5 2 3 7 2 3 2 5
Find the count of occurrences of all the words in a given sentence
Let's say we have a given sentence consisting of more than one repeating words, we need to print all the distinct words present in the sentence and how many times each word is repeated inside the sentence.
Find the number of occurrences of a given character in a string
For a specified string, we would need to find out how many times an input character occurs in the string. For example, in a string "amigo baltigo jijutsu" the character i occurs 3 times. We would need to print the count for every input of a string and a character.
Find the reverse of given number
For any given number we would need to return the number in reverse, with the starting place to the end place. For example, for an input of 1423 we would need to return 3241 which is its exact reverse. To achieve this, we would use the same principle we use for splitting the number; the Divisibility by 10 rule.
Find the Factorial of a given number using Recursion
Factorial of a number is calculated by multiplying all the numbers from 1 till the number itself. For any given input number, we are required to calculate factorial, using recursion. Recursion is a technique in which a method calls itself in a loop until some breaking statement is met. This technique makes programming significantly simple and is used in complex computations to save memory.
We use cookies to provide you with a great user experience, analyze traffic and serve targeted promotions.   Learn More   Accept