Question: given. a string 'X' and a character 'Y', give the largest distance between any two occurance of the given chracter in the string. the distance

given. a string 'X' and a character 'Y', give the largest distance between any two occurance of the given chracter in the string.

the distance is given by the number of distinct characters between two ocuurances . if there is no occurance or only one occurance of the given character , the function should return -1.

in java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!