Skip to content

Instantly share code, notes, and snippets.

View RohitK09's full-sized avatar

Rohit Katyal RohitK09

View GitHub Profile
@RohitK09
RohitK09 / Compression Code
Last active August 29, 2015 14:08
Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2blc5a3. If the "compressed" string would not become smaller than the original string, your method should return the original strin
package string;
public class CompressChar {
public String compressString(String str){
char last = str.charAt(0);
int count =0;