
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++

210 Views
In this problem, we need to count the maximum string having common prefix of length K. We can take prefix of length K from all strings and count maximum number of similar prefix using the map data structure. Also, we can use the Trie data structure to solve the problem. Problem statement - We have given an strs[] array containing multiple strings. We need to count the maximum number of strings containing a common prefix of length K. Sample Example Input strs = {"tutorialspoint", "tut", "abcd", "tumn", "tutorial", "PQR", "ttus", "tuto"}; K = 3; Output ... Read More

257 Views
In this problem, we need to find the maximum palindromic string by rearranging the characters of any substring of the given string. We will use bitmasking to solve the largest palindromic substring. If any substring has bitmasking 0, it contains all characters even a number of times. So, we can generate a palindromic string using the characters of that substring, and we need to find the maximum palindromic string among them. Problem statement - We have given a string containing the N numeric characters. We need to find the maximum palindromic string by rearranging the characters of any ... Read More

102 Views
In this problem, we will find the maximum sum of array elements by picking up unselected elements at the left from the current 1's index. We can use the vector list and sort() method to solve the problem or priority queue. The priority queue inserts the element in the sorted order. Problem Statement We have given a binary string alpha and arr[] of the same length. We need to pick all '1' of alpha one by one and take the maximum element which is not picked from the subarray of arr[] formed using 0 to p elements. Here, ... Read More

690 Views
In this problem, we will make all strings of the given array palindromic by swapping the characters of the adjacent string. To solve the problem, we will try to make the character the same at p and str_len - p - 1 index in all strings, and it is only possible if overall characters at pth index and (str_len - p - 1) index is same. Problem statement - We have given an arr containing multiple strings of the same length equal to N. We need to count the minimum number of operations required to make all strings of ... Read More

161 Views
In this problem, we will form a triangle from the given string. The triangle will contain the rows equal to the string length - 1, and in each row, we replace the starting characters equal to the row number with '.' Character. We can use the loop to form each row of the string or string constructor and substr() method. Problem statement - We have given a string alpha. We need to print the string in the triangle pattern. We need to start the triangle with the alpha string and replace the first character of the previous string ... Read More

292 Views
In this problem, we will count the number of substrings of the given string containing all characters with even frequency or any single character with odd frequency. We will use the bitmasking technique to solve the problem. In bitmasking, each bit of the binary string represents the character. Problem Statement We have given a string alpha of length N. It is also given that 'a'

196 Views
A binary string is a type of string which contains only binary characters that are '0' and '1'. We are given a binary string and have to find the triplets that fulfill the condition that the bitwise 'AND' of the first two characters is equal to the bitwise 'AND' of the last two characters. Mathematically: For 0

189 Views
A linked list is a linear data structure that stores the data in the nodes and each node contains the address of the next node to make the connection. A peak or the peak node is the node that is not present at the first or the last place and has a value strictly greater than both of the neighbors. We have to find the maximum distance between two consecutive peaks as there could be more than one peak available. Sample Examples Input Given Linked list: 1 -> 2 -> 3 -> 2 -> 7 -> 1 ... Read More

132 Views
Right Rotations means we have to shift each element towards the right as the 0th index element shift to the 1st index, the 1st index element shift to the 2nd index, ..., and the last element shift to the 0th index. Here we have given an array of integers of size n, integer m, and integer k. Our task is to find the mth element after k right rotations of an array. Here are some examples and explanations to help you understand the issue. Sample Examples Input Array: [ 1, 3, 2, 5, 6, 7 ], k: ... Read More

254 Views
A number is strictly a smaller element means the number should be less than by a minimum difference is 1 and similarly strictly greater element means the number should be greater than by a minimum of difference 1. Here we have given an array of integers of size n and we have to return the count of elements in the array having strictly smaller and strictly greater elements present. Let's see examples with explanations below to understand the problem in a better way. Sample Examples Input N = 5 Array: [ 3, 2, 1, 4, 5 ] ... Read More