Longest common prefix: Difference between revisions

Content added Content deleted
(Change the lcp(a, "", b) case to have lcp(a, b) != ""; otherwise it's not testing what is desired)
m (→‎{{header|Go}}: add lcp(a, "", b) where lcp(a,b) != "" example)
Line 66: Line 66:
{"throne", "throne"},
{"throne", "throne"},
{"throne", "dungeon"},
{"throne", "dungeon"},
{"throne", "", "throne"},
{"cheese"},
{"cheese"},
{""},
{""},
Line 80: Line 81:
lcp(["throne" "throne"]) = "throne"
lcp(["throne" "throne"]) = "throne"
lcp(["throne" "dungeon"]) = ""
lcp(["throne" "dungeon"]) = ""
lcp(["throne" "" "throne"]) = ""
lcp(["cheese"]) = "cheese"
lcp(["cheese"]) = "cheese"
lcp([""]) = ""
lcp([""]) = ""