Prateek Jangid has Published 190 Articles

Reverse a Doubly-Linked List in Groups of a Given Size using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 10:27:24

265 Views

In this problem, we are given a pointer to the head of a linked list and an integer k. In groups of size k, we need to reverse the linked list. For example −Input : 1 2 3 4 5 (doubly linked list), k = 3 ... Read More

Reverse a Doubly Linked List using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 10:18:03

451 Views

In this article we have a doubly linked list, and we will explain different approaches to reverse a doubly linked list in C++. For example −Input : {1, 2, 3, 4} Output : {4, 3, 2, 1}There is generally one approach that comes to mind, but we will use two ... Read More

Reversal Algorithm for Right Rotation of an Array using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 10:07:24

622 Views

In this article, we will understand the Reversal algorithm to rotate a given array by k-elements to the right, for example −Input : arr[ ] = { 4, 6, 2, 6, 43, 7, 3, 7 }, k = 4 Output : { 43, 7, 3, 7, 4, 6, 2, 6 ... Read More

Reversal Algorithm for Array Rotation using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 10:04:02

144 Views

In the given problem, we are given an array, and we are required to rotate the array by d elements using a reversal algorithm, for example −Input : arr[] = [1, 2, 3, 4, 5, 6, 7], d = 2 Output : arr[] = [3, 4, 5, 6, 7, 1, ... Read More

Return Statement vs Exit() in Main() using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 09:58:54

3K+ Views

If you are a programmer, you write the code; If you write the code, you use the function; if you use the function, you use return and exit statements in every function. So In this article, we will discuss what a return statement and exit statement are and their ... Read More

Result of sizeof operator using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 09:56:03

190 Views

Sizeof operator is one of the most used operators in C language used to compute the size of any data structure or data type that we pass through it. The sizeof operator returns unsigned integer type, and this operator can be applied to primitive and compound data types. We can ... Read More

Repeated Unit Divisibility using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 09:52:43

83 Views

In this article, we will discuss finding the number of repeated units divisible by N. Repeated units are the repetitive numbers of 1 only, Let R(k) be the repetitive unit where k is the length of 1’s. E.g R(4) = 1111. So we need to find the minimum number of ... Read More

Removing Elements Between the Two Zeros using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 09:48:57

82 Views

In this article, we will discuss how to remove elements between two zeros from a given string that contains only zero’s and one’s character. The final string should not contain any character ‘1’ surrounded by 0’s. For example −Input : string = “110010” Output : “11000” Explanation: 1 is found ... Read More

Remove repeated digits in a given number using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 09:44:27

402 Views

In this article, we are given a number n, and we need to remove repeated digits in a given number.Input: x = 12224 Output: 124 Input: x = 124422 Output: 1242 Input: x = 11332 Output: 132In the given problem, we will go through all the digits and ... Read More

Remove Leading Zeros from an Array using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 09:42:10

555 Views

We are provided an array, and we are tasked to remove the leading zeros from the given array and then print the array.Input : arr[] = {0, 0, 0, 1, 2, 3} Output : 1 2 3 Input : arr[] = {0, 0, 0, 1, 0, 2, 3} Output ... Read More

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