Category Archives: Strings

Longest sub string of 0’s in a Binary string

Given a string S containing 0’s and 1’s, the task is to find the length of longest continuous substring of 0’s from the given string. Examples: Input: S = 1111111 Output: 0 Explanation: There is no substring of 0’s hence output is 0. Approach: The given problem can be solved by simply iterating through the string. Follow the… Read More »

String in C

In C programming language, a string is a sequence of characters that are stored in an array of characters. The string is terminated with a null character (‘\0’) which marks the end of the string. In C, strings are stored as arrays of characters, and each character in the array represents a character in the string. For example,… Read More »

Dangerous String

A string contains ‘0’ and ‘1’.You have to find out whether the string is dangerous or not. The string will be dangerous in the following two conditions. There are at least 7 continuous occurrences of ‘1’. There are at least 7 continuous occurrences of ‘0’. Examples: Input : 1000000001 Output : YES Explanation: It has more than 7… Read More »