- 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 6665 Articles for C++

Updated on 18-May-2023 12:25:24
In this article, we will discuss how to modify a given string in C++ by rearranging the vowels in alphabetical order at their respective indices. We will also explain the approach used to solve this problem and provide an example with a test case. Problem Statement Given a string, rearrange the vowels in alphabetical order at their respective indices. The consonants in the string should remain in their original order. For example, given the string "tutorialspoint", the output should be "tatiriolspount". Approach The problem can be solved using a simple algorithm. We can first create a separate string that contains ... Read More 
Updated on 18-May-2023 12:23:02
A common task when working with strings is to make sure that a string adheres to certain conditions. One of these conditions could be to ensure that every substring of length K in the string contains unique characters only. This is a frequent requirement in problems related to data encoding, string manipulation, and cryptography. Problem Statement The problem we are trying to solve can be stated as follows − Given a string str and an integer K, modify the string by inserting characters such that every substring of length K in the string contains unique characters only. Proposed Solution We ... Read More 
Updated on 18-May-2023 12:20:40
When working with strings, sometimes we need to modify them in specific ways to meet certain requirements. One such requirement is to modify a string by increasing each character by its distance from the end of the word. In this article, we will discuss an approach to solving this problem using C++. Problem Statement Given a string S, modify the string by increasing each character by its distance from the end of the word. Approach To solve this problem, we can follow the following steps − Tokenize the given string S into individual words. Iterate over each word and ... Read More 
Updated on 18-May-2023 12:18:06
In this article, we'll discuss an intriguing problem in string manipulation - "Minimum swaps required between two strings to make one string strictly greater than the other". We'll understand the problem, detail a strategy to solve it, implement it in C++, and clarify the concept with a relevant example. Understanding the Problem Statement Given two strings of equal length, our goal is to determine the minimum number of character swaps required to make one string strictly greater than the other. The characters are swapped between the two strings, and each swap operation involves exactly one character from each string. The ... Read More 
Updated on 18-May-2023 12:15:13
Palindromes are sequences of characters that read the same forwards and backwards. In computer science and programming, palindromes are a common subject for string manipulation problems. In this article, we will explore the problem of finding the minimum size substring that must be removed from a given string to make it palindromic. We will provide a well-structured C++ solution and include an example to illustrate the test case. Problem Statement Given a string 's' of length 'n', we need to find the minimum size of the substring that should be removed to make the remaining string palindromic. Algorithm Create ... Read More 
Updated on 18-May-2023 12:10:54
Finding the minimum number of swaps required for a substring to contain exactly K 1s is a common problem in the realm of computer science and programming. In this article, we will delve deep into this problem and provide a C++ solution for it. This problem has its applications in various domains, including string manipulation, data structure optimization, and coding challenges in interviews. Problem Statement Given a binary string and a number K, the task is to find the minimum number of swaps required to ensure that every substring of the string has exactly K 1s. Approach To tackle this ... Read More 
Updated on 18-May-2023 12:08:14
In this article, we will explore an intriguing computational problem - "Minimum number of digits required to be removed to make a number divisible by 4". This problem is a common one in coding contests and algorithm-based interviews and offers excellent practice for enhancing your problem-solving skills. First, let's understand the problem statement: We have a number, and our task is to remove the minimum number of digits such that the remaining number is divisible by 4. Conceptual Understanding The problem lies in the realm of number theory. One key fact to understand is that a number is divisible by ... Read More 
Updated on 18-May-2023 12:05:46
In binary strings, flipping a pair of adjacent bits can easily remove a single 0 from the string. However, when we need to remove all the 0s from the binary string, we may need to flip non-adjacent pairs of bits as well. In this article, we will discuss how to determine the minimum number of non-adjacent pair flips required to remove all the 0s from a binary string. Algorithm To solve this problem, we will use a simple greedy algorithm. The idea is to always choose the pair of bits that are farthest apart from each other and have at ... Read More 
Updated on 18-May-2023 12:03:39
In computer science, string manipulation is an essential topic that involves operations such as concatenation, substring, reversing, and more. One common problem related to string manipulation is to remove all 0s from a binary string. In this article, we will discuss an algorithm to solve this problem using a minimum number of non-adjacent pair flips. Problem Statement Given a binary string, we have to remove all 0s from the string using the minimum number of non-adjacent pair flips. A flip is defined as selecting two adjacent characters and swapping them. In other words, we need to find the minimum number ... Read More 
Updated on 18-May-2023 12:01:03
In this article, we delve into a fascinating problem of string manipulation and character encoding in computer science. The task at hand is to minimize the number of swaps between same-indexed characters of two strings to make the sum of ASCII values of characters in both strings odd. We tackle this problem using C++, a robust and versatile programming language favored by many software developers. Understanding ASCII ASCII, short for American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices that use text. Problem Statement ... Read More Advertisements