MCPcopy Index your code
hub / github.com/qiyuangong/leetcode / insert

Method insert

java/720_Longest_Word_in_Dictionary.java:48–55  ·  view source on GitHub ↗
(String word, int index)

Source from the content-addressed store, hash-verified

46 }
47
48 public void insert(String word, int index) {
49 Node cur = root;
50 for (char c: word.toCharArray()) {
51 cur.children.putIfAbsent(c, new Node(c));
52 cur = cur.children.get(c);
53 }
54 cur.end = index;
55 }
56
57 public String dfs() {
58 String ans = "";

Callers 1

longestWordMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected