Found 1452 Articles for C

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

286 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

86 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

61 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

76 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

55 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

57 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 Write Your Own atoi()

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

123 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

Producer-Consumer Problem in C

Way2Class
Updated on 14-Nov-2023 11:56:59

9K+ Views

In concurrent programming, concurrency represents a pivotal concept necessary to comprehend fully how such systems operate. Among the various challenges encountered by practitioners working with these systems stands out the producer-consumer problem - one of the most renowned synchronization issues. In this text, our objective consists of analyzing this topic and highlighting its significance for concurrent computing while also examining possible solutions rooted within C. Introduction In concurrent systems, multiple threads or processes may access shared resources simultaneously. The producer-consumer problem involves two entities: producers that generate data or tasks, and consumers that process or consume the generated data. The ... Read More

Named Pipe or FIFO with example C program

Diksha Patro
Updated on 17-Jul-2023 12:06:22

2K+ Views

Introduction Named pipes, also referred to as FIFOs (First In, First Out), constitute essential IPC systems in software systems. They offer a quick and effective method for successfully transferring information between processes. Specialized kinds of files known as named pipes serve as a means for interaction among unconnected procedures that operate on an identical structure as well as on separate ones. First-in, first-out (FIFO) named pipes ensure that information composed to the line by a single procedure is read from the pipe by another course in the identical order. Therefore, They are particularly advantageous when processes must communicate independently without ... Read More

C Program to Find Minimum Insertions to Form a Palindrome

Prabhdeep Singh
Updated on 11-Jul-2023 16:57:21

221 Views

A palindrome is a string that is just equal to the reverse of it. We are given a string and we have to find the minimum number of insertions of any characters required to make the given string as the palindrome. We will see the three approaches: first recursive approach, then we will memorize this solution, and last, we will implement the dynamic programming approach. Recursive ApproachExample #include // library for input and output #include // library to get the integer limits #include // library for strings // function to find the minimum of ... Read More

1 2 3 4 5 ... 146 Next
Advertisements