We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Strings
- String Similarity
- Discussions
String Similarity
String Similarity
Sort by
recency
|
178 Discussions
|
Please Login in order to post a comment
import java.util.Scanner;
public class StringSimilarity { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); // Number of test cases
Read the number of test cases and input strings. For each string, compute its Z array using the Z algorithm. Sum up the values in the Z array to get the similarity. Output the similarity for each string. Repeat for each test case.
}
//Java solution using recursion function(fails for the test case 11 and 12 yet i got 85.04):
public static int stringSimilarity(String s){
JavaScript solution
i got time limit exceed in 2 test cases, how should i modify this code?
woking solution in RUST :