+ 2
How to get the minimum length of the strings in array of strings
like if we input-["abcd","ab","abd"] so it will return the output -2
5 Réponses
0
from functools import reduce
mylist=['tres','57','fhhjjj','t']
# min=reduce(lambda f,s:min(len(f),len(s)),mylist)
result=sorted(mylist,key=lambda x:len(x))[0]
print(result)
+ 19
or
//import java.util.Arrays;
1)use Arrays.sort (arrayname);
2)take out the first element with index 0 & print its length
+ 4
Seems that you have your answer...
+ 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