As reported: Atlassian P40 (2025), code design round: a
get/putinterface for string keys; follow-up: wildcards inget— afterput("/a/is/b", "yes"), bothget("/a/*/*")andget("/a/is/*")return"yes". Corner cases, design patterns and exception handling were expected, as in machine coding. Also asked at Atlassian in a 2025 P40 technical round as route mapping: register routes with values (e.g."/a/b/c"→"value1","/a"→"test") and look them up with*segments.
Implement PathStore:
put(path, value)— storevalueunderpath(segments separated by/). Putting an existing path again replaces its value.get(pattern)—patternis a path whose segments may be*; a*matches exactly one segment of any value. Return the value of a stored path that matches (same number of segments, every non-*segment equal), ornullif none matches. If several stored paths match, return the value of the one that was stored first (replacing a value does not change when its path was first stored).
Example 1
put("/team/is/great", "yes")
get("/team/is/great") -> "yes"
get("/team/*/*") -> "yes"
get("/team/is/*") -> "yes"
get("/team/*") -> null (different number of segments)
get("/other/*/*") -> null
Example 2
put("/a/b", "first")
put("/a/c", "second")
get("/a/*") -> "first"
put("/a/b", "updated")
get("/a/*") -> "updated"
get("/*/c") -> "second"
get("/*/*/*") -> null
Constraints: at most 8000 calls; paths start with /, have 1–6 non-empty segments and no trailing /; stored paths contain no *; values are non-empty strings.
Code runner format: two lines in LeetCode's design format: the method names ("PathStore", "put", "get") and their arguments. The harness prints the results as a JSON array (null for the constructor, put, and lookups with no match). In C++ and Go, return "" for no match.