Found 34494 Articles for Programming

Program to convert given Binary to its equivalent ASCII character string

Shubham Vora
Updated on 25-Aug-2023 15:53:18

278 Views

In this problem, we need to convert the binary string to the character string. We can convert the binary string to an ASCII number string first, and then we can convert the character string. Problem statement – We have given a binary string bin_str whose size is multiple of 8. We need to convert the binary string to the character string. Sample examples Input bin_str = "0110110001101010" Output 'lj' Explanation – The ‘01101100’ is equivalent to 108 in the decimal, which is equivalent to the ASCII value of the ‘l’. The ‘01101010’ equals 106, and ... Read More

Minimum Number of Insertions in given String to Remove Adjacent Duplicates

Shubham Vora
Updated on 25-Aug-2023 15:49:58

62 Views

In this problem, we will count the minimum number of characters we need to insert to remove all adjacent duplicate characters. To solve the problem, we need to count the total number of adjacent duplicate character pairs. Problem statement – We have given a string named str containing N alphabetical characters. We need to find the total number of different characters we require to add to the string such that the resultant string shouldn’t contain any adjacent duplicated characters. Sample examples Input str = "ccddrt" Output 2 Explanation – We need to insert one character ... Read More

Use Cases of Generative Adversarial Networks

Mithilesh Pradhan
Updated on 27-Aug-2023 13:10:34

86 Views

Introduction In recent years Generative Adversarial Networks have gained a lot of traction and used in numerous use cases. GANs are deep neural network architectures used to generate realistic synthetic data from existing data sets. GANs have two sets of neural networks − the first one generates new images and the second one discriminates between real and generated images. The discriminants give feedback to the generator about the image whether it is real or fake so that the generator can produce better images that look exactly like the real ones. This process is continued till the discriminator fails to differentiate ... Read More

Minimum Jumps from Either End to Reach Largest and Smallest Character in given String

Shubham Vora
Updated on 25-Aug-2023 15:43:26

66 Views

In this problem, we require to find the minimum jumps required to make to reach the largest and smallest character in the given string. We can move to the next or previous character in one jump. We can solve the problem by finding the position of the lexicographically largest and smallest character in the given string. After that, we can find the minimum jumps required to the found indexes from the left and right sides. Problem statement – We have a string str of length N containing the alphabetical characters in the uppercase. We need to find the minimum number ... Read More

Length of Smallest Substring to be Replaced to make Frequency of each Character as N/3

Shubham Vora
Updated on 25-Aug-2023 15:38:41

80 Views

In this problem, we need to find the smallest substring so that we can replace its character and make the frequency of each character equal to the N/3 in the given string. We can use the sliding window technique to solve the problem. We can find the minimum window size, which contains all excess characters, that will be the answer to the problem. Problem statement – We have given a string alpha. The size of the alpha is N which is always divisible by 3. The given task is to find the minimum length of the substring so that we ... Read More

Javascript Program to Minimize Characters to be Changed to make the Left and Right Rotation of a String Same

Shubham Vora
Updated on 25-Aug-2023 15:31:37

67 Views

In this problem, we require to determine the minimal cost to make the string’s left and right rotation same. Here is the observation which we will use to solve the problem. All characters should be equal for strings with odd lengths to make the left and right rotations the same. The string with an even length should have characters same at the even and odd indexes. Problem statement – We have a string of size N containing the different characters. We need to determine the minimum cost to make the left and right rotations of the given ... Read More

Java Program to Minimize Characters to be changed to make the Left and Right Rotation of a String Same

Shubham Vora
Updated on 25-Aug-2023 15:24:18

76 Views

In this problem, we need to change the minimum characters in the given string to make its left and right rotations the same. In the string, we can observe that we can only make the left and right rotations of the string same if the string has an odd length and all characters are same, or the string has an even length and characters at even and odd indexes the same. For example, abab – Left and right rotation of the string is baba and baba. aaa – Left and right rotation of the stirng is aaa and aaa. ... Read More

Non-Linear SVM in Machine Learning

Mithilesh Pradhan
Updated on 27-Aug-2023 13:01:41

1K+ Views

Introduction Support Vector Machine (SVM) is one of the most popular supervised Machine Learning algorithms for classification as well as regression. The SVM Algorithm strives to find a line of best fit between n−dimensional data to separate them into classes. a new data point can thus be classified into one of these classes. The SVM algorithm creates two hyperplanes while maximizing the margin between them. The points that lie on these hyperplanes are known as Support Vectors and hence the name Support Vector Machine. The below diagram shows the decision boundary and hyperplanes for an SVM that is used to ... Read More

Java Program to Find Maximum number of 0s placed consecutively at the start and end in any rotation of a Binary String

Shubham Vora
Updated on 25-Aug-2023 15:22:27

76 Views

In this problem, we will write Java code to find the maximum sum of consecutive zeros at the start and end of any string rotation. First, we will use a naïve approach to solve the problem, which generates all rotations of the binary string and counts the starting and ending consecutive zeros. After that, we will learn an optimized algorithm that counts the maximum consecutive zeros. Problem statement – Here, we have a string of size N containing only 0 and 1 characters. We need to find the maximum sum of consecutive zeros at the start and end of any ... Read More

Mini Batch K-means clustering algorithm in Machine Learning

Mithilesh Pradhan
Updated on 27-Aug-2023 12:59:35

599 Views

Introduction Clustering is a technique to group data points into various subgroups such that each point within each subgroup are similar. It is an unsupervised algorithm and there are no labels or ground truth. Mini batch K Means is a variant of the K−Means algorithm that trains from batches at random from memory. In this article let us understand Mini Batch K−Means in detail. Before moving on to Mini Batch K−Means let us have a look at K−Means in general The K−Means clustering approach The K−Means is an iterative approach that tries to group data points into K separate subgroups ... Read More

Advertisements