日期:2014-05-20 浏览次数:20867 次
String aa = "abaacabdcabd"; String[] bb = aa.split("ab"); int count = bb.length-1; System.out.println(count);
------解决方案--------------------
/** * 链表去重及倒置 */ public static LinkedList<Integer> offer(LinkedList<Integer> e) { Map<Integer, Integer> map = new HashMap<Integer, Integer>(); LinkedList<Integer> list = new LinkedList<Integer>(); Integer i; for (Integer r : e) { if (map.containsKey(r)) map.put(r, map.get(r) + 1); else map.put(r, 1); } for (Integer j : map.keySet()) { if (map.get(j) == 1) list.add(j); } Collections.reverse(list); return list; }