**Given two strings str1 and str2 and below operations that can performed on str1. Find minimum number of edits (operations) required to convert ‘str1’ into ‘str2’.**

1.Insert

2.Remove

3.Replace

All of the above operations are of equal cost.

def operations(s1,s2,l1,l2): if l1==0: return l2 if l2==0: return l1 if s1[l1-1]==s2[l2-1]: return operations(s1,s2,l1-1,l2-1) return 1 + min( operations(s1,s2,l1,l2-1) , operations(s1,s2,l1-1,l2) , operations(s1,s2,l1-1,l2-1) ) s1=input('Enter string Str1 : ') s2=input('Enter string Str2 : ') print(operations(s1,s2,len(s1),len(s2)))

**Input_1:**

Enter string Str1 : sunday

Enter string Str2 : saturday

**Output: **

3

**Input_2:**

Enter string Str1 : fax

Enter string Str2 : fox

**Output: **

1

**Input_3:**

Enter string Str1 : fuckthecode

Enter string Str2 : fcukthecode

**Output:**

2

**Input_4:**

Enter string Str1 : fuckthecoed

Enter string Str2 : fuckthecode

**Output: **

2

**Input_5:**

Enter string Str1 : python

Enter string Str2 : python3

**Output: **

1

**Illustration of the Output : ?**

**More Q**

- Find the majority element appearing more than n/2 times
- Return an array of the squares of each number.
- Highest factor in addition.
- Find the empty packets(0) of chocolate and push it to the end of the conveyor belt(array).
- Every element in array appears twice.Find that single one.
- Find the duplicate letters in string. Same to do in dictionary way.
- Find minimum number of edits (operations) required to convert ‘str1’ into ‘str2’.
- Return the maximum number you can get by changing at most one digit.
- Sed Commands – Ranges of lines.
- Find the kth smallest element in the given 2D array.
- Find all elements that appear more than [n/3] times.
- Write a function to return true if s2 contains the permutation of s1.
- Sort the array into a wave like array.
- Re-order array, such that
`nums[0] < nums[1] > nums[2] < nums[3]...`

. - Given the coordinates, return true if the four points construct a square.
- Minimum Distance Between Words of a String.
- Return the shortest distance between these two words.
- Write a program to find the n-th ugly number.
- Check if array could become Non – Decreasing array.
- Find the minimum area of a rectangle that can be formed from given points.