- 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 34494 Articles for Programming
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
151 Views
In this problem, we need to check whether the given number is an unsigned integer using the DFA. We need to construct the DFA using the 2D array to solve the problem. Problem statement – We have given string str of length N. By constructing the DFA, we need to check whether the str represents the unsigned integer. In the output, print ‘unsinged integer’ or ‘Not an unsinged integer’ according to whether the number is unsinged or not. Sample examples Input– str = "1729" Output– “Unsigned integer.” Explanation– As the number doesn’t contain any sign, it is an ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
108 Views
In this problem, we need to check whether we can make two strings equal by rearranging the words of the string. We will learn three different approaches to solving the problem. In the first approach, we will use a dictionary. In the second approach, we will use the sort() method, and in the third approach, we will use the counter() constructor, which is used to count the hashable objects in the python. Problem statement – We have given a str1 and str2 containing sentences. We need to check whether we can make both strings equal by rearranging the words of ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
52 Views
In this problem, we have given two arrays of strings. We need to replace array1’s values to sort array1. To replace the values of array1, we can take the GCD of the current string of array1 with any string of array2. The GCD of the string is very similar to the GCD of the number. To solve the problem, we can find a GCD string lexicographically larger than the GCD of the string at the ith index in array1 and the jth index in array2. Problem statement – We have given array1 and array2 containing the strings, and the length ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
104 Views
In this problem, we need to modify the given string by adding the value of the digit from the num string to the ASCII value of str’s character. To solve the problem, we can convert the digit character to the actual digit and add it to the ASCII value of the character. If the ASCII value becomes greater than 122, we start again from 97. Problem statement – We have given two strings of the same length equal to N. The first string, named str, contains the lowercase alphabetical characters, and the second string, named num, contains digits only. ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
47 Views
We have given an array of positive integers and need to modify each element of the array by removing the characters given the ‘hex’ string from the hexadecimal representation of the current element. To solve the problem, we can convert the current number to a hexadecimal number. After that, we can remove the characters from the hexadecimal string, which are common in ‘hex’ and the current hexadecimal string. After modifying the hexadecimal string, we can convert it back to decimal. Problem statement – We have given an array containing positive integers, and the array's length is N. Also, we ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
90 Views
In this problem, we have given a binary string of length 4*N, and we need to flip zeros of the binary string so that any pair of indices containing ‘1’ should not be co-prime or divisible by each other. Here, we can solve the problem by observation. The string contains 4*N characters. We can flip the N characters from the last, which are at the even index. Problem statement – We have given an integer N and a binary string of the length 4*N containing all zeros initially. We need to flip ‘0’ to ‘1’ in such a way so ... Read More
![Sonal Meenu Singh](https://www.tutorialspoint.com/assets/profiles/605896/profile/60_1123519-1677042019.jpeg)
181 Views
Introduction In this tutorial, we implement examples using C++ programming logic to reverse the alternate k characters in an input string. We define the value of k to reverse the characters in a given string. K is the number of characters to be reversed. The value of k can be anything. If the value of k is more than the total number of characters in the string we do not reverse any of the string characters. Demonstration 1 String = “tutorialspoint” K = 4 Output otutrialiopsnt In the above demonstration, we consider a string “tutorialspoint” to ... Read More
![Sonal Meenu Singh](https://www.tutorialspoint.com/assets/profiles/605896/profile/60_1123519-1677042019.jpeg)
150 Views
Introduction In this tutorial, we discuss the problem of range queries to find the element having Maximum Digit Sum in C++. To solve the problem, take an array of elements and some queries. The queries denote the indices of the array and using those queries find the array element with the maximum digit sum. Maximum digit sum is the highest sum of two digit numbers (addition of ones and tens place digits) or one digit number. For example: 12, its sum is 3 (1 + 2). In this tutorial, by using the queries find such a number that has a ... Read More
![Sonal Meenu Singh](https://www.tutorialspoint.com/assets/profiles/605896/profile/60_1123519-1677042019.jpeg)
56 Views
Introduction In this tutorial, we implement an approach in C++ to resolve queries for the count of even digit sum elements in the given range. We use a segment tree. To solve this task, we consider an array of elements with queries defining the range of the subarray. In that subarray count the even digit sum elements. Predefine the element array and the queries to resolve the problem using the Segment tree. What is a segment tree? A segment tree is a binary data structure that stores array interval or segment information. It efficiently solves range or segment query problems. ... Read More
![Sonal Meenu Singh](https://www.tutorialspoint.com/assets/profiles/605896/profile/60_1123519-1677042019.jpeg)
136 Views
Introduction This tutorial implements an approach to printing Strings In Reverse Dictionary Order Using Trie. Trie is a data structure with a tree representation. It is in ordered form and provides an efficient approach for string retrieval. It has nodes and edges like a tree data structure. To solve the task, initialize an array and arrange strings in reverse dictionary order using the trie. Each alphabet is used as a node in the tree. Duplicate array elements are printed only once. Demonstration 1 arr[] = {“hello", "world", "open", "ai", "c++", "programming"”} Output world programming open hello c++ ai ... Read More