
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7197 Articles for C++

4K+ 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 differences.In C++, return is a statement that returns the control of the flow of execution to the function which is calling.Exit statement terminates the program at the point it is used.int main()This is where the execution of the program begins. The program is executed from the main() function, and since ... Read More

278 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 use sizeof operator directly to data types and know the memory it is taking up −Example#include using namespace std; int main() { cout

188 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 k for which R(k) is divisible by N, for example −Input : N = 13 Output : k = 6 Explanation : R(6) i.e 111111 is divisible by 13. Input : N = 31 Output : k = 15Approach to find The SolutionYou can approach this problem by checking ... Read More

159 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 between two zeros at the 4th index. Input : string = “0010” Output : “000” Explanation : 1 is found between two zeros at the 2nd index.Approach to find The SolutionWe can apply a simple approach, i.e., traverse the string using a loop and check the previous and next ... Read More

555 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 remove the repeating digits.Approach to find The SolutionIn the given approach, we will go through all the digits of n from right to left now. We go through digits of n by taking mod of n with 10 and then dividing n with 10. Now our current digit is n ... Read More

797 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 : 1 0 2 3We can make a new array that doesn’t contain the leading zeroes of the previous array in the given problem.Approach to find The SolutionIn this approach, we will go through the array and insert all the numbers but no leading zeros.Example#include using namespace std; ... Read More

206 Views
We are provided with a singly linked list, and we are tasked to remove the last node from that list. In this problem, we are simply going to traverse through the given list and simply remove the last node.Approach to find The SolutionIn this approach, we go through the given list, and we keep track of the previous node and the current node. Now when our current node becomes the last node, we change previous -> next to NULL and delete the current node.Example#include using namespace std; struct Node { int data; struct Node* next; }; ... Read More

253 Views
Given a linked list, we need to remove its first element and return the pointer to the head of the new list.Input : 1 -> 2 -> 3 -> 4 -> 5 -> NULL Output : 2 -> 3 -> 4 -> 5 -> NULL Input : 2 -> 4 -> 6 -> 8 -> 33 -> 67 -> NULL Output : 4 -> 6 -> 8 -> 33 -> 67 -> NULLIn the given problem, we need to remove the first node of the list and move our head to the second element and return the head.Approach to ... Read More

529 Views
In this article, we will explain the way to remove every k-th node of the linked list. We must delete every node that sits on the multiple of k, i.e., we have to delete the node on positions k, 2*k, 3*k, etc.Input : 112->231->31->41->54->63->71->85 k = 3 Output : 112->231->41->54->71->85 Explanation: As 3 is the k-th node after its deletion list would be : First iteration :112->231->41->54->63->71->85 Now we count from 41 the next kth node is 63 After the second iteration our list will become : 112->231->41->54->71->85 And our iteration continues like this. Input: 14->21->23->54->56->61 k ... Read More

4K+ Views
In this article, we’ll be solving the problem of removing a given word from a given string. For example −Input : str = “remove a given word ”, word = “ remove ” Output : “ a given word ” Input : str = “ god is everywhere ”, word = “ is ” Output : “ god everywhere ”Approach to find The SolutionFor example, we can use a simple approach to remove a word from a string.First, put the given string in 2-D matrix form, where each word is stored in each row.Find the word in the matrix ... Read More