Created
April 14, 2015 07:32
-
-
Save stephen-maina/2dc81d42ef2a7c9c116d to your computer and use it in GitHub Desktop.
not fast enough
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.HashMap; | |
class Solution { | |
public int[] solution(String S, int[] P, int[] Q) { | |
// write your code in Java SE 8 | |
int []result=new int[P.length]; | |
for(int index=0;index<P.length;index++){ | |
String check= S.substring(P[index],Q[index]+1); | |
if(check.contains("A")){ | |
result[index]=1; | |
}else if(check.contains("C")){ | |
result[index]=2; | |
}else if(check.contains("G")){ | |
result[index]=3; | |
}else{ | |
result[index]=4; | |
} | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment