Prateek Jangid has Published 188 Articles

C++ Permutations of a Given String Using STL

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 10:24:01

1K+ Views

A permutation of a string is formed when the character of the given strings are rearranged in any form. In this tutorial, we are going to discuss how we can print all the permutations of a given string using C++’s Standard Template Library, for exampleInput : s = “ADT” ... Read More

C++ Permutation of an Array that has Smaller Values from Another Array

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 10:21:23

165 Views

Two arrays, A and B, are given to us in this tutorial. For example, we need to output any permutation of A so that the indices for which A[ I ] > B[ I ] are maximized, for exampleInput: A = [12, 22, 41, 13], B = [1, 20, 10, ... Read More

C++ Perimeter and Area of Varignon’s Parallelogram

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 10:18:46

209 Views

Varignon’s Parallelogram is formed by joining midpoints of each side of a quadrilateral. Let’s say we have a quadrilateral ABCD. The midpoints of each side are P, Q, R, and S. If we connect all the midpoints, it will always form a parallelogram PQRS known as Varignon’s Parallelogram.In this tutorial, ... Read More

C++ Pentatope Number

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 10:16:27

174 Views

A pentatope number is described as the fifth number in the pascal’s triangle. Now, as you know, it’s the fifth number, so it means that we need to have at least five numbers in the pascal’s triangle, so this series’ first number starts from 1 4 6 4 1 the ... Read More

C++ Path with Maximum Average Value

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 10:14:21

182 Views

Given a 2 D matrix in this problem, and we need to find the paths having maximum average value. For the path, our source is the topmost left cell, and the destination is the bottommost right cell, for example −Input : Matrix = [1, 2, 3 4, 5, 6 7, ... Read More

C++ Path Length having Maximum Number of Bends

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 10:11:47

216 Views

To solve a problem in which we are given a binary tree. Now we need to find the path having the maximum number of bends. i.e., A bend is considered when the direction of the path changes from left to right or vice versa, for exampleInput −Output −6Now in this ... Read More

C++ Partition a Number into Two Divisible Parts

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 10:09:04

256 Views

In this problem, we are given a string that can be interpreted as a number. Now we have to perform the partition that string into two parts such that the first part is divisible by A and the second part is divisible by B (two integers given to us). For ... Read More

C++ Partitioning a Linked List Around a Given Value and Keeping the Original Order

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 10:07:04

257 Views

Given a linked list in this tutorial, and we need to keep all the numbers smaller than x at the start of the list and the others at the back. We also need to retain their order the same as previously. for exampleInput : 1->4->3->2->5->2->3, x = 3 Output: 1->2->2->3->3->4->5 ... Read More

C++ Pandigital Number in a Given Base

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 10:04:57

580 Views

A number that contains all the digits from 0 to base B is called the Pandigital number in that base. However, some numbers have digits from 1 to 9 and are called zeroless pandigital numbers. Some Examples of pandigital numbers are 0123456789, 0789564312, etc.In this tutorial, we will discuss a ... Read More

C++ Pairwise Swap Elements of a Given Linked List

Prateek Jangid

Prateek Jangid

Updated on 25-Nov-2021 09:59:09

406 Views

To solve a problem in which we are required to swap the pairwise nodes present in a linked list and then print it, for exampleInput : 1->2->3->4->5->6->NULL Output : 2->1->4->3->6->5->NULL Input : 1->2->3->4->5->NULL Output : 2->1->4->3->5->NULL Input : 1->NULL Output : 1->NULLThere are two ways ... Read More

Advertisements