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

# Strings

### 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,…

### 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…

### Check if the string has a reversible equal substring at the ends

Given a string S consisting of N characters, the task is to check if this string has an reversible equal…

### Count of ways to empty given String by recursively removing all adjacent duplicates

#include using namespace std; int dp[505][505], choose[502][502]; int calc(int l, int r, string& s){ if (abs(r – l) % 2 == 0) { return…