Counting the distance between words in Python

Medium

Suppose you are given two words, word_1 and word_2, as well as a string containing them, called your_string.

Given this, write a function using Python to find the minimum distance between word_1 and word_2. For the context of this question, distance is defined as the number of words between word_1 and word_2....

Sign in to InterviewQs to view this question

Or

New to InterviewQs? Sign up now.

By proceeding, you agree to our Terms and Conditions and Privacy Policy.

Loading editor...