Sunidhi Bansal has Published 1100 Articles

Maximum difference elements that can added to a set in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 07:16:58

66 Views

According to the problem we are given a set arr[n] where n is the number of integer elements in the set, the task is to find the maximum difference elements which are to be added to obtain the elements in the set. In other words, the difference should be in ... Read More

Count number of Distinct Substring in a String in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 07:15:26

485 Views

According to the problem we are given a string str, we must count all the substrings in the given string. Substring is a string which is a part of an already existing string whose size may be smaller than or equal to the existing string.Let's understand the problem and its ... Read More

Maximum difference between two subsets of m elements in C

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 07:13:21

586 Views

The task is to find the greatest difference between the sum of m elements in an array. Suppose we have an array and a number m, then we will first find the sum of highest m numbers and then subtract the sum of lowest m numbers from it to get ... Read More

Maximum difference of sum of elements in two rows in a matrix in C

Sunidhi Bansal

Sunidhi Bansal

Updated on 14-Aug-2020 07:11:14

198 Views

We are given a matrix and the task is to find the greatest difference between the sum of elements in two rows of a matrix. Suppose we have a matrix M[i, j] with i rows and j columns. Let the rows be R0 to Ri-1. The difference will be calculated ... Read More

Count Distinct Non-Negative Integer Pairs (x, y) that Satisfy the Inequality x*x + y*y < n in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 08:42:05

159 Views

We are given a positive integer N. The goal is to count the pairs of distinct non-negative positive integers that satisfy the inequality − x*x + y*y < N.We will start from x=0 to x2 lt; N and y=0 to y2 < N . If any x2 + y2 < ... Read More

Reasons for a C++ program crash

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 08:37:52

863 Views

The abnormal behavior of C++ programs often leads to program crash. You may have encountered problems like Segmentation fault, Aborted, Floating point exception etc. Following are sample programs that may help you to understand the reasons for a C++ program crash.ExceptionsExceptions in C++ are responses of a program when it ... Read More

Program for sum of geometric series in C

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 08:35:00

5K+ Views

Given three inputs first one is “a” which is for the first term of geometric series second is “r” which is the common ratio and “n” which are the number of series whose sum we have to find.Geometric series is a series which have a constant ratio between its successive ... Read More

Program for triangular patterns of alphabets in C

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 08:32:35

221 Views

Given a number n, the task is to print the triangular patterns of alphabets of the length n. First print the n characters then decrement one from the beginning in each line.The triangular pattern of alphabet will be like in the given figure below −Input − n = 5Output Input − ... Read More

Profit and loss Problems using C

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 08:29:46

2K+ Views

Given a certain cost price(cp) and a selling price(sp) of an unknown product or a service, our task is to find the profit earned or loss suffered using a C program where if the profit is earned should print “Profit” and it’s amount or if the loss is suffered “Loss” ... Read More

Product of all prime numbers in an Array in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 08:27:34

154 Views

Given an integer array arr[] with some elements, the task is to find the product of all the prime number of that numbers.Prime number are those number which are either divided by 1 or the number itself, or a prime number is a number which is not divisible by any ... Read More

Advertisements