TCS NQT Coding Question 2021 with solution.
The question was :
An English teacher wants the overall development of the students, She plans a surprise quiz to test the analytical skills of the students. She gives two words (str1,str2) the task for the students here is
Observe both the words carefully
Change the word1 to word2.
The student who can change the words with a minimum number of steps is the winner.
Notes
Only of the operations-insert, delete, or replace can be performed in one step. All the operations should be performed only in the word. The string cannot have any special characters, space, or numbers.
Example 1:
input:
capture - Value of str 1
capsule - Value of str 2
Output:
2 - number of steps required to convert str1 to str2
Explanation:
To convert capture to capsule in
Step 1: t' is replaced with s' (capsure)
Step 2: r is replaced with l (capsule)
Hence, the output is 2.
Example 2:
Input:
computer - Value of str 1
compute - Value of str 2
Only r has to be removed
Output :
1 - number of steps required to convert str 1 to str 2
--------------------------------------------------------------------------------------------
#TCS #NQT #NInjaCodingQuestion #TCSNINJA2021 #TCSHandsONCoding