Given three strings A, B, and C of equal length, the task is to find the minimum number of replacement…

# Strings

### Print all Balanced Brackets Strings that can be formed by replacing wild card ‘?’

import java.io.*;import java.util.*;class Main { static void print(char ch[]) { for (Character c : ch) { System.out.print(c); } System.out.println(); } static boolean check(char ch[]) { Stack S = new Stack(); if…

### Maximize 0s to be flipped in given Binary array such that there are at least K 0s between two 1s

Given a binary array arr[] and an integer K, the task is to count the maximum number of 0’s that…

### Minimum number of adjacent swaps to reverse a String

Given a string s. The task is to minimize the number of adjacent swaps required to reverse the string. Examples:Attention reader!…

### Count of 3 length strings using given characters containing at least 2 different characters

Given three integers a, b and c which denotes the frequencies of three different characters ‘A‘, ‘B‘, and ‘C‘ respectively,…

### Count of Binary Strings of length at most N with set bit count as multiple of K

Given two integers N and K, the task is to find the count of binary strings of at most N…

### Find minimum value expression by inserting addition or multiplication operator between digits of given number

Given string str that contains only digits, the task is to return an expression by inserting the ‘+’ or ‘*’…

### Minimum adjacent swaps required to get Kth smallest number greater than given number

#include using namespace std; void minSwapsKthLargest(string str, int k){ string res = str; for (int i = 0; i < k; i++) { next_permutation( str.begin(),…

### Minimum characters to be replaced in Ternary string to remove all palindromic substrings for Q queries

#include #define SIZE 100005using namespace std; void preprocess(string& s, string& t, int prefix[][SIZE], int n, int i){ prefix[i][0] = (s[0] != t[0]); for (int j…

### Maximum length of consecutive 1s or 0s after flipping at most K characters

#include using namespace std; int maxLength(string str, int n, char c, int k){ int ans = -1; int cnt = 0; int left = 0; for…