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

Method findMinimumCharacters

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

Source from the content-addressed store, hash-verified

36import java.util.*;
37class find {
38 public static int findMinimumCharacters(String searchWord, String resultWord)
39 {
40 int p = 0;
41 int q = 0;
42 while(p < searchWord.length())
43 {
44 if(searchWord.charAt(p) == resultWord.charAt(q))
45 {
46 q += 1;
47 if(q == resultWord.length())
48 {
49 return 0;
50 }
51 } p += 1;
52 } return (resultWord.length() - q);
53 }
54 public static void main(String[] args) throws Exception
55 {
56 try (Scanner sc = new Scanner(System.in)) {

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected