Longest Substring with At Most X 0s and Y 1s of Given String

Prabhdeep Singh
Updated on 24-Aug-2023 14:11:39

274 Views

A substring is the continuous sequence of the character from the given string which can be achieved by removing some character from the front and the end of the substring (possibly all or none). We are given a binary string and we have to find the length of the longest substring that contains at most X number zeros and Y number of ones where X and Y are given inputs. Sample Examples Input  string str = "101011"; int x = 1; int y = 2; Output The length of the longest substring with at most X zeroes and ... Read More

XOR of All Substrings of a Given Binary String

Prabhdeep Singh
Updated on 24-Aug-2023 14:09:57

373 Views

A binary string is a string that contains only two different types of characters in it which are '0' and '1'. Substrings are strings that are formed by deleting some character from the given string from the beginning and from the ending (possibly zero or all). We are given a string and we have to get all the substrings of it and take XOR of it. XOR is a bitwise operator that gives the result − if both the bits are the same then it will return zero otherwise 1. Input  string str = "10101" Output  XOR of all ... Read More

Minimum Cost to Delete Characters from String A to Remove Subsequence as String B

Prabhdeep Singh
Updated on 24-Aug-2023 14:02:39

379 Views

We are given two strings string A and string B along with an array that represents the cost to delete the ith character of the given string A. We need to delete some characters of string A (possibly zero or none) with the minimum cost such that no subsequence of A represents string B. We are going to see three approaches to implementing the code that is the recursive approach; the recursive and memoization approach; and tabulation or iterative dp. Example Let's have a look at the following example − Input string a = "xanxd" string b = ... Read More

Transform String A into B by Deleting Characters and Reinserting

Prabhdeep Singh
Updated on 24-Aug-2023 13:56:43

137 Views

Anagram of a string means a string contains exact same characters as another string with the order of characters may vary from the original string, so we called that both strings are anagram of each other. Here we have given the two strings first and second which are anagrams of each other. And our task is to minimize the count of operations to make the first string as second string. An operation is that we can delete an character from the begin or end of an first string and reinserting at any position. Sample Example Input  First: "hello", Second: "ohlle" ... Read More

Count of Possible Distinct Binary Strings After Replacing '11' with '0'

Prabhdeep Singh
Updated on 24-Aug-2023 13:54:22

129 Views

A binary string is a string that contains only two types of different characters zeroes and ones. We can replace a substring '11' of the given string with another string '0' and we have to find the number of different possible strings we can get from it. We are going to use dynamic programming to get the solution as other methods may take exponential time complexity. Sample Example Input string str = 11010 Output 2 Explanation We can replace the first two numbers with the zero and can get another string 0010 and the second string is the ... Read More

Create Python Objects Based on an XML File

Gireesha Devara
Updated on 24-Aug-2023 12:45:36

2K+ Views

XML (Extensible Markup Language), which is a markup−language that is used to structure, store, and transfer data between systems. At some point we need to read/write the XML data using the Python language. By using the untangle library we can create Python objects based on an XML file. The untangle is a small Python library which converts an XML document to a Python object. The untangle has a very simple API. We just need to call the parse() function to get a Python object. Syntax untangle.parse(filename, **parser_features) Parameters Filename: it can be a XML string, a XML filename, ... Read More

Gradient Descent in Linear Regression

Jay Singh
Updated on 24-Aug-2023 12:36:24

851 Views

The use of linear regression is a useful technique for figuring out and examining the relationship between variables. Predictive modeling relies on it and uses it as the cornerstone for many machine learning techniques. Machine learning requires a lot of optimization. It is comparable to improving a model to provide it with the best performance. Gradient descent, a key technique in optimization, enters the picture at this point. Consider it as a trustworthy ally that will help us navigate the vast array of potential model parameters to find the optimal ones. Gradient descent allows us to iteratively change these ... Read More

Training of ANN in Data Mining

Jay Singh
Updated on 24-Aug-2023 12:32:07

559 Views

In the field of data mining, training artificial neural networks (ANNs) is extremely important. ANNs are potent computer models that draw inspiration from the complex operations of the human brain. ANNs have revolutionized data science, machine learning, and artificial intelligence through their capacity to spot patterns, learn from data, and predict the future. Extraction of insightful information from sizable and complicated datasets is what data mining, a crucial aspect of these disciplines, entails. By training ANNs, data scientists and practitioners can make use of the network's ability to unearth obscure patterns, spot trends, and create prediction models that might radically ... Read More

Pattern Evaluation Methods in Data Mining

Jay Singh
Updated on 24-Aug-2023 12:29:57

5K+ Views

In data mining, the process of rating the usefulness and importance of patterns found is known as pattern evaluation. It is essential for drawing insightful conclusions from enormous volumes of data. Data mining professionals can assess patterns to establish the applicability and validity of newly acquired knowledge, facilitating informed decision−making and generating practical results. Several metrics and criteria, including support, confidence, and lift, are used in this evaluation method to statistically evaluate the patterns' sturdiness and dependability. In this post, we will be looking at pattern evaluation methods in data mining. Let’s begin. Understanding Pattern Evaluation In the field of ... Read More

How AI Will Affect Our Lives in the Next Decade

Jay Singh
Updated on 24-Aug-2023 12:28:54

237 Views

The development of computer systems that can carry out activities that traditionally require human intellect is referred to as artificial intelligence (AI). Learning, thinking, solving problems, and making decisions are some of these duties. AI covers a number of related disciplines, including computer vision, natural language processing, and machine learning. One cannot exaggerate how important it is in the modern world. AI has altered several sectors and how people live and work. We can automate boring and repetitive jobs thanks to it, which boosts productivity and efficiency. Virtual assistants, recommendation engines, and personalized adverts are just a few examples of ... Read More

Advertisements