Count Even Digit Sum Elements in Given Range Using Segment Tree

Sonal Meenu Singh
Updated on 18-Aug-2023 16:45:44

128 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

Print Strings in Reverse Dictionary Order Using Trie

Sonal Meenu Singh
Updated on 18-Aug-2023 16:29:28

247 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

Number of Times the Given String Occurs in the Array in the Range

Sonal Meenu Singh
Updated on 18-Aug-2023 16:19:30

118 Views

Introduction In this tutorial, we implement examples using C++ to find the number of times an input string occurs in an array of the range [l, r]. Only lowercase alphabets are used in the string array to resolve this task. Different strings are stored in the string array and traversed to check if a particular string exists. This is for a given range of L and R. L and R are the starting and ending index values of an array to search a string for that range in the input string array. Find string lying between L and R of ... Read More

Minimum Number of Substrings of a String Such That All Are Power of 5

Sonal Meenu Singh
Updated on 18-Aug-2023 16:09:12

217 Views

Introduction In this tutorial, we implement 2 examples using C++ to find the minimum number of substrings in a given string. Those substrings are all powers of 5 that means, the substrings are the factors of the number 5. To implement the example, take an input binary string and generate the minimum possible substrings that are factors of 5. If you want to know whether a substring is a power of 5 or not, check its decimal values. The binary string is a combination of 1 and 0 and we cannot find a particular binary string that is ... Read More

How Many HTML Colors Are There?

Ayush Singh
Updated on 18-Aug-2023 15:19:28

413 Views

Hexadecimal notation is used by HTML to express colours, providing a wide range of options. A staggering 16, 777, 216 different colours can be expressed in total. Three sets of two-digit hexadecimal integers that represent the intensity of the RGB (red, green, and blue) components are combined to create colours in HTML. Examples include pure red (#FF0000), green (#00FF00), and blue (#0000FF). Various RGB values provide a wide range of colour options. This extensive colour palette enables web developers and designers to create aesthetically stunning and varied web sites, enhancing the user experience as a whole. They can captivate users ... Read More

Modify Array by Removing Characters from Hexadecimal Representations

Shubham Vora
Updated on 18-Aug-2023 15:15:38

132 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

Modify Binary String by Flipping Characters for Non-Coprime Indices

Shubham Vora
Updated on 18-Aug-2023 15:14:22

157 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

Minimum Time Required to Complete All Tasks Without Altering Their Order

Shubham Vora
Updated on 18-Aug-2023 15:12:35

239 Views

In this problem, we need to find the total time required to complete all tasks according to the given condition. We can use the map data structure to solve the problem. We can keep tracking the last performed time for each task, and if the time interval is less than K, we can increment time units accordingly. Problem statement – We have given a string task containing alphabetical characters of length N. Each character represents a task, and we need one unit of time to perform the tasks. Also, the condition is that each task should be performed at ... Read More

Minimum Increments by 1 or K to Convert String

Shubham Vora
Updated on 18-Aug-2023 15:10:46

436 Views

We have given two strings and need to convert one string to another by click increments, and we can increment characters by either 1 or k in the single operation. To solve the problem, we need to make all characters of the first string the same as a second character by performing the cyclic increment operations. If the character at the same index in both strings is the same, we don’t need to perform any increment operation. Problem statement – We have given two strings named first and second containing the uppercase alphabetical characters. The length of both strings ... Read More

HTML and DHTML Differences

Ayush Singh
Updated on 18-Aug-2023 15:09:50

3K+ Views

Both HTML (HyperText Markup Language) and DHTML (Dynamic HTML) offer unique characteristics. DHTML mixes HTML, CSS, and JavaScript to introduce dynamic and interactive components, whereas HTML defines web page structure statically. Without having to reload the page, DHTML enables user interaction, animations, and real-time content modifications. DHTML's dynamic characteristics, in contrast to HTML's static nature, improve site construction and offer more interesting and interactive web experiences. HTML Websites rely heavily on HTML (HyperText Markup Language) to efficiently organise and deliver internet content. It defines headings, paragraphs, images, and links using a variety of tags, allowing for the proper structuring of ... Read More

Advertisements