- 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 1861 Articles for Data Structure
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
108 Views
In this article, we will be exploring an interesting problem related to expressions and grammar. The problem statement is "Print a sorted list of words represented by the expression under the given grammar". This problem offers a great opportunity to brush up your knowledge on parsing expressions, handling strings, and sorting algorithms. Problem Statement Given a string expression where each character represents a lowercase English letter and the '|' character represents an OR operation, the task is to print a sorted list of all possible words represented by the expression. Solution Approach Our approach to solve this problem is by ... Read More
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
227 Views
In this article, we'll delve into a fascinating problem that involves numbers and permutations: "Permutation of a number whose sum with the original number is equal to another given number". This problem offers a unique intersection of number theory and combinatorics, making it a compelling challenge to tackle. To clarify, given an original number and a target number, we need to find a permutation of the original number such that, when we add the original number and its permutation, we get the target number. Understanding the Problem In essence, this problem combines the concepts of number permutation, summation, and equality ... Read More
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
106 Views
In this article, we will explore a common string manipulation problem: moving all digits to the beginning of a given string. This task is often seen in data cleaning or preprocessing, where we need to standardize or reformat strings in a certain way. A widely-used programming language celebrated for its efficiency and control. Problem Statement Given a string that contains alphanumeric characters, our task is to move all the digits present in the string to the beginning, while keeping the order of the rest of the characters the same. Solution Approach Our approach to solving this problem involves two key ... Read More
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
140 Views
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
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
86 Views
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
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
168 Views
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. 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 for each ... Read More
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
148 Views
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
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
397 Views
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 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 a function isPalindrome that takes a ... Read More
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
72 Views
In this article, we will delve into an interesting string manipulation problem: "Minimum replacements such that no palindromic substring of length exceeding 1 is present in the given string". This problem challenges us to calculate the minimum number of character replacements required to ensure that a given string contains no palindromic substrings of length more than 1. We will explain the problem and clarify the concept with an example. Understanding the Problem Statement A string is given to us, and our task is to determine the minimum number of character replacements needed to ensure that the string does not contain ... Read More
![Siva Sai](https://www.tutorialspoint.com/assets/profiles/641140/profile/60_712060-1681791038.jpg)
63 Views
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