Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions Hashing/SubString.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void main(String[] args){
}
}
/*
* public static ArrayList<Integer> findSubstring(String a, final List<String> b) {
* public ArrayList<Integer> findSubstring(String a, final List<String> b) {
ArrayList<Integer> result = new ArrayList<Integer>();
if(b.size() == 0)
return result;
Expand Down Expand Up @@ -107,17 +107,29 @@ public static void main(String[] args){
}
return result;
}
public static boolean check(String s, int l, int n, HashMap<String, Integer> map){
String temp;
for(int i =0; i < n; i= i + l){
temp = s.substring(i, i + l);
if(map.containsKey(temp)){
if(map.get(temp) < 1)
return false;
else
map.put(temp, map.get(temp) - 1);
}
public boolean check(String s, int l, int n, HashMap<String, Integer> map){
String checkWord=s;
System.out.println(checkWord);
String temp;
for(int i =0; i < n; i= i + l){
temp = s.substring(i, i + l);
if(map.containsKey(temp)){
// if(map.get(temp) < 1)
// return false;
// else
map.put(temp, map.get(temp) - 1);
}
}
Iterator<Integer> keyVals=map.values().iterator();
boolean endResult=true;
while(keyVals.hasNext()){
if(keyVals.next()==0){

}else{
endResult=false;
return endResult;
}
return true;
}
*/
return endResult;
}
*/