- 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 1862 Articles for Data Structure
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
189 Views
In this problem, we need to show all words of the string having the prime length. The logical part of the problem is getting the words from the string and checking whether its length is prime. We can check whether the length of the number is divisible by any number to ensure whether it is a prime number. Also, we will use the sieve of Eratosthenes and the wheel factorization algorithm to check whether the word length is a prime number. Problem statement − We have given a string alpha, and we need to print all words of ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
106 Views
In this problem, we will count the number of operations required by increasing the prefix characters of the given string. We will use character difference to count the minimum number of operations required to make string palindromic. Problem Statement We have given a string nums containing the numeric digits. We need to count a minimum number of operations required to convert a string into the palindrome. In one operation, we can select any prefix of the string and increment all prefix characters by 1. Sample Example Input nums = "22434" Output 2 Explanation ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
102 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
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
111 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
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
67 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
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
385 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
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
74 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
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
135 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'
![Prabhdeep Singh](https://www.tutorialspoint.com/assets/profiles/546958/profile/60_1428686-1667456005.jpg)
71 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
![Prabhdeep Singh](https://www.tutorialspoint.com/assets/profiles/546958/profile/60_1428686-1667456005.jpg)
79 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