Line 1: error: class, interface, or enum expected [in MainClass.java] 第一次刷leecode 用给的solution 粘贴进去会报这错误。 在第一行加一个public class Solution 开头结尾再加一个括号就可以了。