MCPcopy Create free account
hub / github.com/Rohit91singh9/Coding-DP-DSA / findMinimumCharacters

Method findMinimumCharacters

Find_Minimum_Character.java:5–21  ·  view source on GitHub ↗
(String searchWord, String resultWord)

Source from the content-addressed store, hash-verified

3import java.util.*;
4class Result {
5 public static int findMinimumCharacters(String searchWord, String resultWord) {
6 // Write your code here
7
8 int p = 0;
9 int q = 0;
10 while(p < searchWord.length())
11 {
12 if(searchWord.charAt(p) == resultWord.charAt(q))
13 {
14 q += 1;
15 if(q == resultWord.length())
16 {
17 return 0;
18 }
19 } p += 1;
20 } return (resultWord.length() - q);
21 }
22 public static void main(String[] args) throws Exception
23 {
24 Scanner sc = new Scanner(System.in);

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected