MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / isDuplicate

Method isDuplicate

Java/buddy-strings.java:10–20  ·  view source on GitHub ↗
(String str)

Source from the content-addressed store, hash-verified

8*/
9class Solution {
10 public boolean isDuplicate(String str){
11 int[] fre = new int[26];
12 for(int i=0; i<str.length(); i++){
13 int ind = str.charAt(i) - 'a';
14 fre[ind]++;
15 if(fre[ind] > 1){
16 return true;
17 }
18 }
19 return false;
20 }
21 public boolean buddyStrings(String A, String B) {
22 if(A.length() != B.length()){
23 return false;

Callers 1

buddyStringsMethod · 0.95

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected