# Strings

### Minimum value of K such that each substring of size K has the given character

Given a string of lowercase letters S a character c. The task is to find minimum K such that every…

### Find the single digit sum of alphabetical values of a string

Given string S of size N, the task is to find the single-digit sum by the repetitive sum of digits…

### Count of distinct groups of strings formed after performing equivalent operation

#include using namespace std;  int Find(vector& parent, int a){    return parent[a]           = (parent[a] == a ? a : Find(parent, parent[a]));}  void Union(vector& parent,           vector& rank,…

### Sort an array of strings based on the given order | Set-2

Given an array of strings words[] and the sequential order of alphabets, the task is to sort the array according…

### Minimize count of 0s in Binary String by changing K-size substring to 1s at most Q times

const INT_MAX = 2147483647;                    const minZeroeCount = (S, K, Q) => {                let N = S.length;                        if (K == 0 || Q ==…

### Sum of the shortest distance between all 0s to 1 in given binary string

#include using namespace std;void findTotalDistance(string S, int N){            vector prefixDistance(N);    vector suffixDistance(N);            int cnt = 0;        bool haveOne = false;    for (int i = 0;…

### Print all ways to reach the Nth stair with the jump of 1 or 2 units at a time

Given a positive integer N representing N stairs and a person it at the first stair, the task is to…

### Check if count of 1s can be made greater in a Binary string by changing 0s adjacent to 1s

Given a binary string S of size N, the task is to check if the count of 1s can be…