Found 7197 Articles for C++

Check if a given string can be formed using characters of adjacent cells of a matrix

Sakshi Koshta
Updated on 31-Jul-2023 13:35:20

229 Views

Let's first understand the meaning of neighbour cells in matrices. To determine how each component fits into your two-dimensional matrix structure visualize each enclosed unit as being encompassed by almost eight adjacent elements positioned across/from them both diagonal directions in addition to vertical/horizontal ones. An example observation can be made about lattice size - the smallest circular enclosure in this design has nine components.(from left-to-right & up-to-down)Cell [row=9, col=8] -- within reach from [row=8, col=7], ...[row=10, col=8], and so forth. This intricate connection network links these adjacent components where they share edges or corners; creating a well-defined matrix structure stepping ... Read More

The camel case character present in a given string

Thanweera Nourin A V
Updated on 28-Jul-2023 15:54:09

842 Views

The aim of this article is to implement a program to print the number of camel case character present in a given string. As you all know, a string is a collection of characters. Now let us see what camel case letters are. Programming languages like Java utilise a naming style called camel case. That is, It includes entering multi-word identities without spaces or underscores, having the initial word in lowercase with successive words in uppercase. Code written in this manner is easier to read and understand. The inner uppercase letters, which resemble camel humps, are what give the name ... Read More

Program to perform a letter frequency attack on a monoalphabetic substitution cipher

Thanweera Nourin A V
Updated on 28-Jul-2023 15:52:42

1K+ Views

The challenge is to display the top five probable plain texts which could be decrypted from the supplied monoalphabetic cypher utilizing the letter frequency attack from a string Str with size K representing the given monoalphabetic cypher. Let us see what exactly is frequency attack. The very foundation for frequency analysis is the certainty that specific letters and letter combinations appear with varied frequencies all through any given section of written language. Additionally, matter-of-factly every sample of that language shares a common pattern in the distribution of letters. To make it more clear, The English alphabet has 26 letters, ... Read More

Minimum steps to determine the subsequence with max 1s based on given conditions

Thanweera Nourin A V
Updated on 10-Aug-2023 15:56:16

112 Views

The aim of this article is to implement a program to find minimum steps to determine the subsequence with max 1s based on given conditions. So as we all know, a one-dimensional array containing characters that is terminated by a null can be used to define a string. Given is a string Str of length K, wherein K is always even, and contains the characters "0, " "1, " and "?" Divide the string to two separate strings, let's call them Str1 and Str2, each of which is going to include the characters at the even values of Str and ... Read More

Minimize count of repositioning of characters to make all given Strings equal

Thanweera Nourin A V
Updated on 10-Aug-2023 15:48:22

142 Views

The aim here is to determine whether it would be feasible to make all of the strings identical in any amount of operations provided an array Str of strings with size n. Any element can be taken out of the string and put back in at any point in the same or another string all in one action. Return "Yes" if the strings are able to be made to equal one another, and "No" if not, along with the fewest number of operations necessary. Problem Statement Implement a program to minimize count of repositioning of characters to make all given ... Read More

Maximum sum of lengths of a pair of strings with no common characters from a given array

Thanweera Nourin A V
Updated on 28-Jul-2023 17:00:24

275 Views

The aim of this article is to implement a program to maximize the sum of lengths of a pair of strings with no common characters from a given array. By definition, a string is a collection of characters. Problem Statement Implement a program to maximize the sum of lengths of a pair of strings with no common characters from a given array. Sample Example 1 Let us consider the Input array: a[] = [“efgh”, “hat”, “fto”, “car”, “wxyz”, “fan”] Output obtained: 8 Explanation There are no characters in the strings "abcd" and "wxyz" in common. As a ... Read More

Maximum possible balanced binary substring splits with at most cost k

Thanweera Nourin A V
Updated on 28-Jul-2023 15:37:48

141 Views

The array in the C programming language has a fixed size, which means that once the size is specified, it cannot be changed; you can neither shrink it or extend it. As we know, an array is a group of identically data-typed elements kept in consecutive memory regions. Given an array of values v[] and a binary array a[]. The objective is to use as many k coins to divide the binary array as much as is possible while ensuring that each segment has an equal amount of 0s and 1s. i and j are the neighboring indices of the ... Read More

Decode a given string by removing duplicate occurrences

Thanweera Nourin A V
Updated on 28-Jul-2023 15:34:20

209 Views

The aim of this article is to implement a program to decode a given string by removing duplicate occurrences. As you are aware of what a string is, a string is nothing but a collection of characters. Also there is no restriction in the repetitions of characters in a string. A string can have the same character occurring multiple times. In this we will figure out a way to decode a given encoded string str by removing duplicate occurrences. The objective would be to decode the provided string str, which has been encoded with 'a' appearing just once, 'b' twice, ... Read More

Count of strings to be concatenated with a character having frequency greater than sum of others

Thanweera Nourin A V
Updated on 10-Aug-2023 15:45:40

103 Views

Our main aim here is to determine the most strings that are capable of being concatenated to ensure that just one letter has a frequency that exceeds the total of all the other characters, provided an array called arr[] containing M strings. Before going further, let's understand some basic concepts of array and string. The array is nothing but a group of identically data-typed elements held in consecutive memory sections. The array in the C programming language has a fixed size, which means that once the size is specified, it cannot be changed; you cannot shrink or extend it. Let's ... Read More

Count of N-length binary strings that are repeated concatenation of a substring

Thanweera Nourin A V
Updated on 28-Jul-2023 15:22:00

154 Views

The aim of this article is to implement a program to count of N-length binary strings that are repeated concatenation of a substring. The goal is to determine how many binary strings of the length N can be created by repeatedly concatenating a single substring of a given text, provided a positive integer called N. Problem Statement Implement a program to count of N-length binary strings that are repeated concatenation of a substring. Sample Example 1 Let us take the Input, N = 3 Output: 2 Explanation Listed below are the feasible binary string of length N=3 with ... Read More

Advertisements