public int ladderLength(String start, String end, Set<String> dict) {
		if (dict.size() == 0)
			return 0;
		int curLevel = 1;
		int nextLevel = 0;
		int steps = 1;
		boolean isEndReached = false;
		Queue<String> bfsQueue = new LinkedList<String>();
		Set<String> visited = new HashSet<String>();
		bfsQueue.add(start);
		while (!bfsQueue.isEmpty()) {
			String cur = bfsQueue.remove();
			curLevel -= 1;
			if (stringDiff(cur, end) == 1) {
				isEndReached = true;
				// Important - Need to add steps by 1
				steps += 1;
				break;
			}
			StringBuffer sb = new StringBuffer(cur);
			for (int i = 0; i < sb.length(); i++) {
				char c = sb.charAt(i);
				for (int j = 0; j < 26; j++) {
					sb.setCharAt(i, (char) ('a' + j));
					String oneStepStr = sb.toString();
					if (dict.contains(oneStepStr)
							&& !visited.contains(oneStepStr)) {
						bfsQueue.add(oneStepStr);
						visited.add(oneStepStr);
						nextLevel += 1;
					}
				}
				sb.setCharAt(i, c);
			}
			if (curLevel == 0) {
				curLevel = nextLevel;
				nextLevel = 0;
				steps += 1;
			}
		}
		return isEndReached ? steps : 0;
	}