codewars028: Persistent Bugger

https://www.codewars.com/kata/55bf01e5a717a0d57e0000ec/train/javajava

package codewars;
//--https://www.codewars.com/kata/55bf01e5a717a0d57e0000ec/train/java
class Persist{
  public static int persistence(long n){
    int count = 0;
    while(sb.length() > 1){
      long product = 1;
      for(int i = 0; i < sb.length(); i++){
        product *= Long.valueOf(String.valueOf(sb.charAt(i)));
      }
      sb = new StringBuilder(String.valueOf(product));
      count++;
    }
    return count;
  }
}
相關文章
相關標籤/搜索