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

529 Views
Introduction In graph theory, a Hamiltonian path is a sequence of vertices that visits each vertex exactly once, with no repeated edges. It is named after Sir William Rowan Hamilton, an Irish mathematician who contributed significantly to various fields, including graph theory. In this article, we will dive deep into understanding and counting all possible Hamiltonian paths within a directed graph using C++ programming. Now, it's up to us to apply these principles and unlock the secrets concealed within different types of directed graphs. Count all Hamiltonian paths in a given directed graph A directed graph consists of a set ... Read More

138 Views
In this problem, we need to construct the original string from the given string. The given string is formed from the original string using the given rules. Here, we can use the given encryption rule and encrypted string to find the decrypted string by applying the encryption rule in reverse order. Problem statement – We have given a binary string bin_str of length N and positive integer k. The binary string is constructed from the ‘enc’ string by following the below operations and using the x value. If enci-k is equal to 1, bin_stri is equal to 1. If ... Read More

224 Views
Introduction In the area of graph theory, unweighted bidirectional graphs form a fundamental framework for modeling various real-world scenarios. These graphs allow us to explore relationships between different entities, such as road networks or social connections. One key aspect that captures our attention is finding paths between two nodes and determining their respective lengths. In this article, we dive into one interesting facet of this topic – understanding the distinction between the shortest path and second shortest path in an unweighted bidirectional graph. Shortest and second shortest path Unweighted bidirectional (or undirected) graphs consist of vertices or nodes connected by ... Read More

344 Views
In this problem, we will find a minimum number of string characters needed to be replaced to make all characters. In the first approach, we will find the minimum count of the replaceable characters by counting the frequency of each character in the given string. In another approach, we will determine the cost to convert all string characters to a particular character and take the minimum value from that. Problem statement – We have given a string alpha containing N alphabetical characters. We need to find the minimum number of characters to replace to make all string characters equal. Sample ... Read More

132 Views
In this problem, we need to construct one string by slicing the other string. We can use the longest common substring to solve the problem. We can find the longest common substring between both strings, slice str1 into 1 or 2 parts, and remove the substring from str2. Again, we find the longest common substring in updated strings and follow it until str2 becomes empty. In this way, we can solve the problem. Problem statement – We have given str1 and str2 strings of different lengths. We need to construct the string str2 by slicing and concatenating the parts of ... Read More

111 Views
Introduction In computer programming, solving problems often requires us to manipulate strings effectively while accounting for their diversity. One interesting challenge is to determine the count of distinct groups that can be formed after performing equivalent operations on a given set of strings. In this article, we will explore an efficient approach using C++ code to tackle this problem and unlock new possibilities. By employing key algorithmic steps such as group identification, formation, and computation, programmers can effectively tackle challenges related to manipulating diverse sets of strings while maintaining their unique properties. Count of distinct groups of strings formed after ... Read More

176 Views
In this problem, we will find the lexicographically smallest string by concatenating the given string’s prefix and its reverse. We can find the lexicographically smallest prefix of the string and get the required string. Problem statement – We have given a string alpha containing the alphabetical characters. We need to construct the lexicographically smallest string, which we can get by concatenating any string prefix with its reverse. Sample examples Input alpha = "welcome"; Output 'wewe’ Explanation – The lexicographically smallest prefix is ‘we’. So, we have concatenated it with its mirror. Input alpha = "tutorialspoint" ... Read More

291 Views
In this problem, we need to extract the integer from the given string by following the rules in the problem statement. We can solve the problem by checking if the initial substring of the string follows each rule given for the valid integer value. Problem statement – We have given string digits containing the numeric digits, ‘.’, ‘+’, and ‘-‘ characters. We need to extract the valid integer value from the given string. Rules for valid integers It should not contain the leading zeros and whitespaces. The integer should either start with a sign or digits. When any sign ... Read More

126 Views
In this problem, we need to find the original string from the encrypted string using the given encryption rules. We can get the original string if we use the encryption rules in reverse order. Problem statement – We have given an encrypted string. Also, we have given an array of strings containing multiple strings. We need to find the string from the array, so if we encrypt according to the below rules, we can get the encrypted string. Encryption rules The encrypted string should start with a positive integer, representing a number of uppercase letters in the original string. ... Read More

206 Views
In this problem, we need to find the largest even valued substring of the given string. The even string always contains the 2, 4, 6, 8, 0 at last. So, we can take all substrings of the given string, and if any substring is even and greater than the maximum substring, we can update the maximum substring value. Problem statement – We have given string str containing numeric digits only. We need to find the largest substring of the str, which is an even integer value. Sample examples Input str = "1234789" Output 123478 Explanation ... Read More