public static String lookAndSay(int sequenceNumber) {
    if (sequenceNumber <= 0)
      return null;
   
    String output = "1";
    int i = 1;
   
    while (i < sequenceNumber) {
      StringBuilder stringBuilder = new StringBuilder();
      int count = 1;
      for (int j = 1; j < output.length(); j++) {
        if (output.charAt(j) == output.charAt(j - 1)) {
          count++;
        } else {
          stringBuilder.append(count);
          stringBuilder.append(output.charAt(j - 1));
          count = 1;
        }
      }
   
      stringBuilder.append(count);
      stringBuilder.append(output.charAt(output.length() - 1));
      output = stringBuilder.toString();
      i++;
    }
   
    return output;
}


This Coding Interview Question is available with an answer in the following programming languages :