From b29660656ddf42e3034f579333febb65ed6fd77e Mon Sep 17 00:00:00 2001 From: Bhaskar Kulshrestha <95305804+BhaskarKulshrestha@users.noreply.github.com> Date: Thu, 9 Feb 2023 09:54:00 +0530 Subject: [PATCH] Create minimum operation to convert one string to another string.md --- ...to convert one string to another string.md | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 strings/minimum operation to convert one string to another string.md diff --git a/strings/minimum operation to convert one string to another string.md b/strings/minimum operation to convert one string to another string.md new file mode 100644 index 0000000..567285a --- /dev/null +++ b/strings/minimum operation to convert one string to another string.md @@ -0,0 +1,42 @@ +### QUESTION + + Given two strings s1,s2 , convert s1 to s2; + operations: + 1. change any character from a to b or b to a + 2. any two characters can be swapped with cost |i-j| + +## Code in CPP +```.cpp + +#include +using namespace std; +int main(){ + string s1,s2; + cin>>s1>>s2; + + int cost=0; + for(int i=0;i