+ 1
How to find the length of the string for which any character in string is again exists?
like if give input-zbbbbbbbbbbzbbbbb then the output will be 10 because the length of the string between two z are10
11 Answers
0
you could split the string on the letter "z" and then just call the length method on every element and return the highest
+ 4
Well... That's why we are here, I'm grateful to discuss this logically. Let's wait for Nikhil comment.
+ 3
Should it count from any pair of characters?
Or it searchs from an entered character?
For example:
*input = z
*output=10
**input = s
**output= 0
+ 3
Buddy, i've thought in a way to do it, but i saw your other post, and it has many many possibilities to find a couple without any criteria. Example:
Input - abcdedcba
There are 4 couples, and different lengths between them... Which of them should be the output?
+ 3
Jeremy is right... But how will the program know which letter split.
+ 3
In a comment up... Seems Nikhil wants the program to find the pair... Rather than tell to the program that counts the length between a character entered by the user.
+ 2
it count any pair of character
+ 2
you either tell it or make it a fix character. if he just wants the longest substring with the same letter he could split the string on a character change and then return the longest substring
+ 2
tbh i dont exactly know what he wants, in his original post there ate 10 b's which results in the output 10. in his comment there is only one letter (also a "b") but the output is 2
+ 1
like input-zbzczbz
output- 2
+ 1
Ethical hacker asked to find vulnerabilities in transaction id input should a string(S) value only having lower case letters
S[i]€[a,z] and K is the possible keys,if there exist at least one character C€[a,z] in each and every substring of S of length K key of ID is the minimum of such possible Ks.
some test cases:-
input-zbcde
output-3
input-bbbbb
output-1
input-zbzczbz
output-2
in this question the 3rd case is not working for mine