Why I always get compile error?
I compiled my Java code locally and it will succeed, but every time I submit on LeetCode it will report "Line 8: error: cannot find symbol: class Solution"\nCan
I compiled my Java code locally and it will succeed, but every time I submit on LeetCode it will report "Line 8: error: cannot find symbol: class Solution"\nCan anyone tell me whether my code has an error or the LeetCode has a bug?\n\nMy code:\n```java\nimport java.util.*;\nclass Solution {\n    public String longestWord(String[] words) {\n        if (null == words || 0 == words.length) return "";\n        Trie root = new Trie();\n        for (String word : words)\n            root.insert(word);\n        List<String> list = new ArrayList<>();\n        for (String word : words)\n            if (root.search(word))\n                list.add(word);\n        Collections.sort(list, (String a, String b) -> {\n            if (a.length() == b.length())\n                return a.compareTo(b);\n            return b.length() - a.length();\n        });\n        return list.get(0);\n    }\n    public class Trie {\n        Trie[] children = new Trie[\'z\'-\'a\'+1];\n        public boolean isWord = false;\n        public int childrenNum = 0;\n        public Trie get(char c) {\n            return children[c-\'a\'];\n        }\n        public void set(char c, Trie t) {\n            childrenNum++;\n            children[c-\'a\'] = t;\n        }\n        public void insert(String word, int i) {\n            if (word.length() == i) {\n                isWord = true;\n                return;\n            }\n            char c = word.charAt(i);\n            Trie child = get(c);\n            if (null == child) {\n                child = new Trie();\n                set(c, child);\n            }\n            child.insert(word, i+1);\n        }\n        public void insert(String word) {\n            insert(word, 0);\n        }\n        public boolean search(String word, int i) {\n            if (word.length() == i) {\n                if (isWord)\n                    return childrenNum == 0;\n            }\n            char c = word.charAt(i);\n            Trie child = get(c);\n            if (null == child || !child.isWord) \n                return false;\n            return child.search(word, i+1);\n        }\n        public boolean search(String word) {\n            return search(word, 0);\n        }\n    }\n}\n```
[]