DG

Dave Green

IT Director at Softwise

Dave Green has over 25 years of professional experience in the IT field. Dave began their career in 1993 as Director of Technical Services at Vinca. Dave then moved on to Softwise in 2008, where they held the role of IT Director. In 2018, Dave joined KNS as Director of IT.

#include <iostream>

#include <vector>

#include <string>

#include <algorithm>

#include <unordered_set>

#include <unordered_map>

#include <utility>

using namespace std;

class Solution {

public:

vector<vector<string>> findLadders(string beginWord, string endWord, vector<string>& wordList) {

vector<vector<string>> res;

if (wordList.empty()) return res;

unordered_set<string> dict(wordList.begin(), wordList.end());

if (dict.find(endWord) == dict.end()) return res;

unordered_map<string, vector<string>> graph;

unordered_map<string, int> dist;

bfs(beginWord, endWord, dict, graph, dist);

vector<string> path;

dfs(beginWord, endWord, graph, dist, path, res);

return res;

}

private:

void bfs(string beginWord, string endWord, unordered_set<string>& dict, unordered_map<string, vector<string>>& graph, unordered_map<string, int>& dist) {

queue<string> q;

q.push(beginWord);

dist[beginWord] = 0;

while (!q.empty()) {

string cur = q.front();

q.pop();

vector<string> nexts = getNexts(cur, dict);

for (string next : nexts) {

graph[cur].push_back(next);

if (dist.find(next) == dist.end()) {

dist[next] = dist[cur] + 1;

q.push(next);

}

}

}

}

vector<string> getNexts(string cur, unordered_set<string>& dict) {

vector<string> res;

for (int i = 0; i < cur.size(); i++) {

char c = cur[i];

for (char j = 'a

Links

Timeline

  • IT Director

    January, 2008 - present