public int ladderLength(String start, String end, HashSet<String> dict) {
		if(start == null || end == null) return 0;
		dict.add(start);
		dict.add(end);
		
		int res = 1;
		Map<String, Boolean> visited = new HashMap<String, Boolean>();
		for(String word : dict) {
			visited.put(word, false);
		}
		HashSet<String> oneIter = new HashSet<String>();
		oneIter.add(start);
		
		while(!oneIter.isEmpty() && !oneIter.contains(end)) {
			HashSet<String> nextIter = new HashSet<String>();
			res++;
			for(String word : oneIter) {
				nextIter.addAll(generateList(word.toCharArray(), visited, dict));
			}
			oneIter = nextIter;
		}
		
		if(oneIter.contains(end)) return res;
		else return 0;
	}