Found 1906 Articles for Data Structure

How to check Aadhaar number is valid or not using Regular Expression?

Sonal Meenu Singh
Updated on 03-Oct-2023 10:41:26

2K+ Views

Introduction In this C++ tutorial, we check whether the input Aadhar number is valid using Regular Expression. Regular expression or regex is used for pattern matching in strings or string searching algorithms. Its functionalities are defined in the header file. It is used with a regex keyword followed by a variable. Indian citizens are issued an Aadhaar number, which is a unique identification number. It is a 12-digit unique number and no two people have a similar AADHAAR number. Syntax regex regular_expression_patternname return regex_match(value, regular_expression_patternname); In this tutorial to check the validity of an Aadhar number we ... Read More

Defanged Version of Internet Protocol Address

Sonal Meenu Singh
Updated on 03-Oct-2023 10:35:23

171 Views

Introduction This tutorial deals with the problem of finding the defanged version of the Internet Protocol Address. The Internet Protocol Address or IP Address is an individual numerical address of a device connected to or using the Internet. It is unique for every internet-connected device. It consists of numbers separated by the period (dot). An example would be 191.0.1.2. Defanged Version of Internet Protocol means replacing the periods (dot.) with other characters so that it is not treated as a valid IP address. For defanging the Internet Protocol Address we use [.] instead of periods ( dot .) The Internet ... Read More

How to decrypt a string according to given algorithm?

Sonal Meenu Singh
Updated on 03-Oct-2023 10:21:02

85 Views

Decryption or decrypt a string is the process used to protect confidential and sensitive data from hackers. It converts encrypted data or text into its original form. Encryption is the process of converting plain text into an unreadable and non-understandable cipher text format so that hackers cannot understand it. These processes are interrelated and involve various algorithms for processing. We decrypt the string according to the following algorithm. If the string length is odd. For odd index values append alphabets from the back of the string and for even index values append alphabets from the front of the input ... Read More

How to Decode the string encoded with the given algorithm?

Sonal Meenu Singh
Updated on 03-Oct-2023 10:29:04

148 Views

Introduction Encoding means converting the text into some form of representation, and decoding is the process of converting the encoded text into its original form. Encoding and decoding are two interrelated techniques for transferring information from one form to another. In this tutorial, we implement an approach to decode the string which is encoded with the given algorithm that finds the decoded string using an encoded string encoded with some algorithm. The string is encoded using the following concept − For example string = India Encoded string = dniIa In the string "India", the middle character is 'd', ... Read More

Count of all substrings with sum of weights at most K

Sonal Meenu Singh
Updated on 29-Sep-2023 17:36:18

169 Views

Introduction In this tutorial, we discuss the problem of counting the substrings from a given string with the sum of weights at most K. To implement the problem statement we consider a string S to generate substrings and some value for k. The character weights are predefined integer values and we consider some value of K like 2, 3 or anything. We count only those substrings whose total weight is equal to the value of K. The weights of the characters are defined in two different ways − When the weights are defined for a string in any order. ... Read More

Check whether the string can be printed using same row of qwerty keypad

Sonal Meenu Singh
Updated on 29-Sep-2023 17:33:46

58 Views

Introduction In this tutorial, we will check if an input string can be formed using characters in the same row of the Qwerty keypad. The task is to check whether a given string exists in a single row of the Qwerty keypad. To determine whether a string can be printed with the same row of the Qwerty keypad, all characters should be found in the same row. We implement an approach using set and unordered_set to solve this task. The characters of different rows are stored in different sets or unordered_sets. Compare the string characters to each stored row value. ... Read More

Check if a substring can be Palindromic by replacing K characters for Q queries

Sonal Meenu Singh
Updated on 29-Sep-2023 17:08:38

108 Views

Introduction In this tutorial, we implement an approach to check substring is palindrome by replacing its K characters for Q queries. Palindromes are words that read the same in both directions. When you read a palindromic word from a forward or backward direction, it sounds the same. For example, madam, refer. Here, Q queries are a numeric array containing the starting index, ending index, and value of K. The starting and ending index values for the input string are used to select only those characters that lie between these starting and ending index values (both values are inclusive). For the ... Read More

Centered Pentadecagonal Number

Rinish Patidar
Updated on 27-Sep-2023 16:04:39

115 Views

The problem includes printing the N-th centered pentadecagonal number for any input number N. A centered pentadecagonal number is a number that can be represented in the form of a figure with a dot in the centre and surrounded by successive layers of the pentadecagon i.e. 15-sided polygon. Here the successive layers of the pentadecagon depict that the first layer surrounding the dot in the centre will be 15-sided polygon, the next layer will be 30-sided polygon followed by a 45-sided polygon and so on. We can understand the concept of centered pentadecagonal with the below figures. The first ... Read More

Centered Octagonal Number

Rinish Patidar
Updated on 27-Sep-2023 15:51:40

121 Views

The problem statement includes printing the N-th centered octagonal number for some positive integer N, which will be given by the user. A centered octagonal number is a type of number which can be represented in a pattern of figures. Every centered octagonal number can be represented as a dot in the centre surrounded by the successive layers of an Octagon. An octagon is a type of polygon in geometry which has 8 sides in it. The successive layers of an octagon means that the first layer surrounding the dot in the centre will be an octagon, the second ... Read More

Centered Octadecagonal Number

Rinish Patidar
Updated on 27-Sep-2023 15:43:03

65 Views

The problem includes to print the N-th centered octadecagonal number, where N will be given as an input. A centered octadecagonal number is a type of figurative number which is represented as a dot in the centre surrounded by the successive layers of the octadecagon. An octadecagon is a polygon with 18 sides in it. The successive layers of the octadecagon are the first layer will be 18-sided polygon, the next will be 36-sided polygon and so on. The numbers can be better explained with the help of figures. The first number is represented as a dot in the ... Read More

Advertisements