Sudhir sharma has Published 1206 Articles

Pick maximum sum M elements such that contiguous repetitions do not exceed K in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 11:03:02

201 Views

In this problem, we are given array arr[] and two integers M and K. our task is to create an Array using elements of the given array. The size of the new array should M and any sub-array of size greater than K cannot have all elements the same. we ... Read More

Pick points from array such that minimum distance is maximized in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 11:00:07

148 Views

In this problem, we are given an array arr[] of n elements that represent N index positions and there are C magnets. Our task is to print all these magnets in such a way that the distance between the two nearest magnets is as large as possible.Let’s take an example ... Read More

Pierpont Prime in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:57:26

88 Views

In this problem, we are given a number n. Our task is to print all Pierpont prime numbers less than n.Pierpont Prime number is a special type of prime number that is of the form, p= 2i . 3k + 1.Where p is a prime number, and i and k ... Read More

Pipes and Cisterns in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:52:55

137 Views

Pipes and cisterns problem is a very common problem and is generally included in competitive exams. So, learning questions related to pipers and cisterns is important and you should know how to solve them as these are not too difficult to learn.Pipes and cisternsThese problems involve pipes that are used ... Read More

Place k elements such that minimum distance is maximized in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:45:21

936 Views

In this problem, we are given an array of n points that lie on the same line. Our task is to place k elements of the array in such a way that the minimum distance between them is maximized.Let’s take an example to understand the problem, Input − array = ... Read More

Place K-knights such that they do not attack each other in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:43:06

401 Views

In this problem, we are given three integer value K, N, M. our task is to place K knights in an NxM chessboard such that no two knights attack each other. There can be cases with 0 valid ways and also cases with multiple valid ways. You need to print ... Read More

Place N^2 numbers in matrix such that every row has an equal sum in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:39:25

139 Views

In this problem, we are given an integer value N. our task is to print numbers within the range (1, N2) in a 2D matrix of size NxN in such a way that the sum elements of each row are equal.Let’s take an example to understand the problem, Input − ... Read More

Playing with Destructors in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 10:35:34

767 Views

Destructor is a function of a class in c++ that does the job of deleting the object of a class.Calling a destructorDestructor is called when the object of a class goes out of the scope in the program. The cases when object goes out of scope, The program goes out ... Read More

Point arbit pointer to greatest value right side node in a linked list in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 09:11:14

70 Views

In this problem, we are given a linked list with a value, link pointer and an arbitrary pointer. Our task is to make the arbitrary pointer point to point the largest value which is on the right side of it in the linked list.Let’s take an example to understand the ... Read More

Point Clipping Algorithm in Computer Graphics in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 09:07:48

571 Views

Computer graphics deals with drawing images and graphics on a computer screen. Here, we treat the screen as a 2-D coordinate system. This coordinate system starts from top-left (0, 0) and ends at bottom-right.Viewing plane is the area defined for drawing graphics in computer graphics. Or the visible area of ... Read More

Advertisements