Round 1: - Implement an ArrayList Class for Integers which has the methods - add(int i), remove(), get(int i), get(int val) - Problem Solving: String compression i/p: aabbbcccc o/p: 2a3b4c
Sigiloso
try something like this : String ab = "aaabbccccddddd"; char[] inp = ab.toCharArray(); HashMap hm = new HashMap(); for(char c : inp) { Integer count = hm.get(c); hm.put(c, (count==null)?1:count+1); } for(Entry entry : hm.entrySet()) { System.out.print(entry.getValue()); System.out.print(entry.getKey()); }