- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 6671 Articles for C++
Updated on 11-Jul-2023 09:02:29
Sorting a string means we have to arrange a given string either in an ascending or descending order or any given order. In this problem given a string 'str' of size n. Our aim is to sort the given string without altering means without changing the position of vowels present in the string. Let's see examples with explanations below to understand the problem in a better way. Sample Examples Input 1 str = “abdecokfee” Output 1 abcedofkee Explanation Constant present in the string = bdckf Sort the constant string = bcdfk Merge the given string with the sorted instant string ... Read More
Updated on 11-Jul-2023 09:00:04
Binary string means the string contains only two types of char either 1 or 0. It is known as base 2. In this problem, we have given a binary string str and also the size of the string 'n'. Our task is to find the maximum number of zeros places consecutively at the start and end of any rotation of a binary string. Let's see examples with explanations below to understand the problem in a better way. Sample Example Input 1 str = “101001, n = 6 Output 1 2 Explanation The string can be rotated in any of the ... Read More
Updated on 11-Jul-2023 08:56:40
Rotation means we have to shift each character forward or backward direction. In the case of forward, the last character is forwarded to the index 0 also known as right rotation. In the case of backward first character at index 0 is backward to the last index also known as left rotation. In this problem, we have given a string of characters and integer d. Our task is to print the left rotated string or right rotated string by d integer. Only the permutation of the current string changes, not the length or frequency of the characters in the ... Read More
Updated on 21-Jun-2023 12:28:28
The problem statement includes checking whether a K-sized very long positive integer is the multiple of 3 or not where each ith digit in the K-sized number where i>1 will be the sum of all the prefix digits modulo 10 from the left.
We will be given two integers a0 and a1, where 1
Updated on 21-Jun-2023 12:26:20
The problem statement includes checking whether a number is Emirprimes or not, where the positive integer N will be the user input. An Emirpimes number is a semiprime number whose when digits are being reversed, gives a new number which too is a semiprime number. A semiprime number is a number which is the product of two prime numbers which can be either distinct or the same. In simple words, for a number N to be semiprime it should be of the form N=a*b, where a and b are prime numbers. They can be equal. In this problem, we will ... Read More
Updated on 21-Jun-2023 12:23:24
The problem statement includes checking the given numbers which will be the user input, if it is a Blum number or not. A Blum integer is a semiprime number whose distinct prime factors a and b are of the form 4t+3, where t is some positive integer. A semiprime number is a number which is a product of exactly two prime numbers or a natural number which has exactly two factors which are prime numbers. In case of semiprime numbers, the factors may be equal. In case any number N which is a blum integer, it must have only two ... Read More
Updated on 18-May-2023 14:12:10
In this article, we are going to explore an interesting problem related to string manipulation in C++. The problem statement is "Sum of frequencies of characters of a string present in another string". This problem provides a great opportunity to enhance your understanding of string operations, character frequency calculation, and the concept of mapping in C++. Problem Statement Given two strings, the task is to find the sum of frequencies of characters of the first string that are present in the second string. C++ Solution Approach To solve this problem, we will first create frequency maps for both strings using ... Read More
Updated on 18-May-2023 14:10:08
In this article, we will delve into a specific aspect of string handling in C++: the string::npos constant. string::npos is a static member constant value with the greatest possible value for an element of type size_t. This constant is defined with a value of -1, which, when cast to size_t, gives us the largest possible representation for size_t. In the context of strings in C++, it is generally used to indicate an invalid position. What is String::npos? In C++, string::npos is a constant static member of the std::string class that represents the maximum possible value for the size_t type. It ... Read More
Updated on 18-May-2023 14:07:45
In this article, we dive into a unique and interesting problem related to arrays and string manipulation in C++. The problem at hand is "Sort an array of strings in ascending order with each string sorted in descending order". This problem is an excellent way to enhance your knowledge of string manipulation, arrays, and sorting algorithms. Problem Statement Given an array of strings, the task is to sort the array in ascending order, but with each string sorted in descending order. C++ Solution Approach We can solve this problem by using the sort function provided by the C++ Standard Library. ... Read More
Updated on 18-May-2023 14:05:54
This article delves into an interesting string manipulation problem: "Remove all occurrences of a word from a given string using Z-algorithm". This problem serves as an excellent use case for the Z-algorithm, highlighting its efficacy in pattern searching problems. Let's explore in detail. Problem Statement Given a string S and a word W, the task is to remove all occurrences of W from S using the Z-algorithm. Understanding the Problem Consider a string S = "HelloWorldHelloWorld" and a word W = "World". The goal is to remove all occurrences of W from S. Hence, the output would be "HelloHello". Z-algorithm ... Read More Advertisements