Count and Say

https://leetcode.com/problems/count-and-say/description/
My GitHub: Count And Say

  • The nth level result is from counting each digit of the result of (n-1) th level.

public String countAndSay(int n) {
        if(n <1){ return null; }

        String result= "1";

        //start from n=2 (n=1: result = 1)
        int start = 2;

        //check n level
        while(start <= n){

           //a loop for comparing the previous digit and the current digit are the same or not, if the same count+1
           for(int i= 1 ; i< result.length(); i++){

           }
        }

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s