LeetCode-Swift
LeetCode-Swift copied to clipboard
Alien Dictionary is failing for ["abc","ab"] test case
@soapyigu , Leetcode has added a new test case ["abc","ab"]. So the solution is failing
I have added this check inside initGraph method, now it's working.
if currentWord.count > nextWord.count && currentWord.starts(with: nextWord){ return ([:], [:]) }
My full solution is https://pastebin.com/f7RzLqfM
Thanks. Seems the requirement from Leetcode has been changed. I just modified the solution and it works now.