soapyigu/LeetCode-Swift

Alien Dictionary is failing for ["abc","ab"] test case

iHackSubhodip opened this issue · 1 comments

@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.