classSolution{ List<List<String>> result = new ArrayList<>(); List<String> tmp = new ArrayList<>(); //记录起始位置 List<String> strs = new ArrayList<>(); Set<String> set = new HashSet<>();
public List<String> findItinerary(List<List<String>> tickets){ strs.add("JFK"); dfs(0, tickets, null);
Collections.sort(result, new Comparator<List<String>>() { @Override publicintcompare(List<String> o1, List<String> o2){ for (int i = 0; i < o1.size(); i++) { if (!o1.get(i).equals(o2.get(i))){ return o1.get(i).compareTo(o2.get(i)); } } return0; } });