Found 34494 Articles for Programming

Minimize count of alternating subsequences to divide a given Binary String with subsequence number

Thanweera Nourin A V
Updated on 31-Oct-2023 16:17:51

59 Views

The aim of this article is to implement a program Minimize count of alternating subsequences to divide a given binary string with subsequence number. Here, you are provided with a binary string as part of the issue. In order to prevent any subsequence from including adjacent zeros and ones, we must reduce the number of subsequences and output the subsequence number that corresponds to each string element. A subsequence represents a sequence which can be created by taking the supplied sequence and eliminating zero or more members while maintaining the initial position of the elements that remain. Input Let ... Read More

Maximum count of characters that can replace ? by at most A 0s and B 1s with no adjacent duplicates

Thanweera Nourin A V
Updated on 31-Oct-2023 17:54:57

435 Views

The aim of this article is to implement a program maximum count of characters that can replace? by at most A 0s and B 1s with no adjacent duplicates. Given a couple of integers A and B, both of which that represent the number of 0s and 1s that are accessible, and a string Str with only the special characters "*" and "?" The aim is to determine the greatest number of characters that may be used in the '?' position without causing any neighboring characters to be identical. Example 1 Let us give the input string str = ... Read More

Position of the leftmost set bit in a given binary string where all 1s appear at the end

Thanweera Nourin A V
Updated on 31-Oct-2023 15:53:13

136 Views

The aim of this article is to implement a program to Position the leftmost set bit in a given binary string where all 1s appear at the end. A string of bits is known as a binary string. A binary string is utilized for storing non-traditional data, such as images, as opposed to a character string, which typically holds text data. The quantity of bytes in a binary string determines its length. Binary data, or data that is portrayed in a binary (base-2) version instead of a text (base-10) format, is stored in binary string variables in computer programming. ... Read More

largest string formed by choosing words from a given Sentence as per given Pattern

Thanweera Nourin A V
Updated on 31-Oct-2023 15:57:04

104 Views

The aim of this article is to implement a program to obtain the Lexicographically largest string formed by choosing words from a given Sentence as per given pattern. As we know, a string is a group of characters that ends with the null character "\0" in C programming. Characters from the C String are kept in a character array. The main difference between A string and a character array is that a C string differs from a character array in that it ends with the distinctive character "\0." Example 1 Input: S = “slow and steady”, B = “sdfh” ... Read More

Find the count of Alphabetic and Alphanumeric strings from given Array of Strings

Thanweera Nourin A V
Updated on 31-Oct-2023 16:08:30

152 Views

The aim of this article is to implement a program to find the count of alphabetic and alphanumeric strings from a given array of strings. As we know, a string is a group of characters that ends with the null character "\0" in C programming. Characters from the C string are kept in a character array. A C string differs from a character array in that it ends with the distinctive character "\0." Input arr[] = {“snmd”, “nej7dnr”, “snmd”, “dltmdj”, “lbwm2p6”} Output 3 2 “snmd”: 2 “nej7dnr”: 1 “dltmdj”: 1 “lbwn2p6”: 1 Explanation The strings ... Read More

Count of sum of “10” subsequences for each 1 in string with A 1s, B 10s and C 0s

Thanweera Nourin A V
Updated on 31-Oct-2023 15:58:43

101 Views

The aim of this article is to implement a program to obtain the count of sum of “10” subsequences for each 1 in string with A 1s, B 10s and C 0s. Example Let us take the Input: A = 1, B = 2, C = 3 Output obtained here is : 14 Explanation A = 1 denotes. There is a single "1" string, B = 2 denotes, there is a pair of "10" strings, and C = 3 denotes, there is a trio of "0" strings. The string that results from concatenation is "11010000". Five ... Read More

Convert a string Str1 to Str2 by moving B to right and A to left without crossover

Thanweera Nourin A V
Updated on 31-Oct-2023 16:00:18

87 Views

The aim of this article is to implement a program to convert a string Str1 to Str2 by moving B to right and A to left without crossover. As we know, a string is a group of characters that ends with the null character "\0" in C programming. Characters from the C String are kept in a character array. A C string differs from a character array in that it ends with the distinctive character "\0". Example Let us take the input strings, str1 = “#B#A#”, and str2 = “##BA#” Output obtained here is: Yes Explanation − 'B' ... Read More

C++ Program to Check if all rows of a matrix are circular rotations of each other

Thanweera Nourin A V
Updated on 30-Oct-2023 16:46:06

52 Views

The aim of this article is to implement a program C++ program to check if all rows of a matrix are circular rotations of each other. Here is a small glimpse on what a matrix exactly is. The rectangular array of symbols or numbers organized in rows and columns is known as a matrix. A matrix can be of many distinct types, including row, column, horizontal, vertical, square, diagonal, identity, equal, and singular. Addition, subtraction, as well as multiplication are the three fundamental matrix operations. The goal is to determine whether all rows of a matrix of size n*n ... Read More

C Program To Write Your Own atoi()

Thanweera Nourin A V
Updated on 30-Oct-2023 16:42:37

237 Views

The aim of this article is to implement a program C Program To Write Your Own atoi(). Before we begin, let us take a deeper understanding of what an atoi() function is all about. This will help in writing the program as well as understanding the concepts pretty much easier. To the ones who are not much aware of what an atoi() function is. Here you go. The atoi() function changes a string of elements into an integer value. The string that is entered is a string of characters that has the potential to become a numeric value of the ... Read More

Minimize given Number by swapping adjacent digits with odd difference

Thanweera Nourin A V
Updated on 30-Oct-2023 15:57:27

71 Views

The aim of this article is to implement a program to minimize a given number by swapping adjacent digits with odd differences. The goal is to determine the lowest amount that can be created from a string of size N indicating an integer using only the characters '1', '2', and '3' by exchanging adjacent characters any number of times. As we all know, a string is a group of characters that ends with the null character "0" in C programming. Characters from the C String are kept in a character array. A C string differs from a character array in ... Read More

Advertisements