- 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 7346 Articles for C++
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
442 Views
We need to find all palindrome strings from the given array in this problem. The string is a palindrome if we can read it the same from the start and end. We can use two approaches to check whether the string is a palindrome. In the first approach, we reverse the string and compare it with the original string, and in the second approach, we keep comparing the string characters from start to last. Problem statement − We have given an array containing the N strings. We need to print all the strings of the array, which are palindrome. If ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
163 Views
In this problem, we need to decode the given string by repeatedly adding the total count number of times. We can have three different approaches to solving the problem, and we can use two stacks or one stack to solve the problem. Also, we can solve the problem without using the two stacks. Problem statement − We have given a string str containing the opening and closing brackets, alphabetical and numeric characters. We need to decode the string recursively. Here are the patterns or rules to decode the string. [chars] − The ‘chars’ should appear count times in ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
106 Views
In this problem, we need to count the total vowels and constants in the given linked list. We can traverse the linked list and check for each character, whether it is a constant or vowel. Problem statement − We have given a linked list containing the lowercase alphabetical characters. We need to count the total number of vowels and constants in the linked list. Sample examples Input 'a' -> 'b' -> 'e', 'c' -> 'd' -> 'e' -> 'f'’ -> 'o' -> 'i' -> 'a' -> 'a' Output Vowel – 7, constant - 4 Explanation − ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
40 Views
In this problem, we need to perform the given operations with each string prefix. In the end, we need to count the frequency of each character. We can follow the greedy approach to solve the problem. We need to take each prefix of length K and update its characters according to the given conditions. We can use the map to count the frequency of characters in the final string. Problem statement − We have given the strings tr containing the N lowercase alphabetical characters. Also, we have given the mapping list, which contains total 26 elements. Each element is mapped ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
148 Views
In this problem, we will check if the linked list contains the string as a subsequence. We can iterate the list and string together to check whether a string is present as a subsequence in the linked list. Problem statement − We have given a string of size N. Also, we have given a linked list of the dynamic length containing the alphabetical characters. We need to check whether the linked list contains the string as a subsequence. Sample examples Input 'e' -> 'h' -> 'e' -> 'k' -> 'h' -> 'e' -> 'l' ->'o' -> 'l' -> 'o' ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
54 Views
In this problem, we need to generate the Lyndon words of the length n using the given characters. The Lyndon words are words such that any of its rotations is strictly larger than itself in the lexicographical order. Here are examples of Lyndon words. 01 − The rotations of ‘01’ is ‘10’, which is always strictly greater than ‘01’. 012 − The rotations of ‘012’ is ‘120’ and ‘210’, which is strictly greater than ‘012’. Problem statement − We have given an array s[] containing numeric characters. Also, we have given n representing the length ... Read More
![Vaishnavi Tripathi](https://www.tutorialspoint.com/assets/profiles/637500/profile/60_4109383-1681206430.jpg)
3K+ Views
In this article, we will discuss different approaches to calculate the number of positive integers which have no repeated digits between a given range Low to high. The first approach is a brute force approach which iterates over all the numbers in the range and check if they contain repeated digits. In our second approach, we calculated the desired count using prefix array while in our last approach we used the concept of memorization in dynamic programming to get the desired result. Problem Statement: We are given two numbers low and high and we have to find the count of ... Read More
![Vaishnavi Tripathi](https://www.tutorialspoint.com/assets/profiles/637500/profile/60_4109383-1681206430.jpg)
261 Views
In this article, we will discuss what is Tomohiko Sakamoto’s algorithm and how this algorithm is used to identify which day of the week does the given date occurs. There are multiple algorithms to know the day of the week but this algorithm is the most powerful one. This algorithm finds the day of the month on which the date occurs in least possible time and least space complexity. Problem statement − We are given a date as per Georgian calendar and our task is to find out which day of the week occurs on the given date using ... Read More
![Vaishnavi Tripathi](https://www.tutorialspoint.com/assets/profiles/637500/profile/60_4109383-1681206430.jpg)
1K+ Views
In this article, we will discuss a few recursive practice problems with their detailed solutions. Let us first understand what recursion is and how it works: Recursion − Recursion is a programming technique in which a function or method calls itself multiple times in order to solve a problem. The function breaks down the problem into smaller sub-problems and solves them until it reaches a base case. The base case is a stopping condition that makes sure that the function stops calling itself and returns a result in finite time. Recursion is a powerful technique for solving complex ... Read More
![Vaishnavi Tripathi](https://www.tutorialspoint.com/assets/profiles/637500/profile/60_4109383-1681206430.jpg)
210 Views
In this article, we will discuss the code solution to swap every alternate bit in a given number and return the resultant number. We will use the concept of bit manipulation in order to solve the problem in constant time without using any loops. Problem statement − We are given a number n, we have to swap the pair of bits that are adjacent to each other. In other words, we have to swap every odd placed bit with its adjacent even placed bit. Constrain: While solving the problem, we have to keep In mind that we cannot use ... Read More