<s> class Solution : <EOL> def isHappy ( self , n ) : <EOL> lookup = { } <EOL> while n != <NUM_LIT:1> and n not in lookup : <EOL> lookup [ n ] = True <EOL> n = self . nextNumber ( n ) <EOL> return n == <NUM_LIT:1> <EOL> def nextNumber ( self , n ) : <EOL> new = <NUM_LIT:0> <EOL> for char in str ( n ) : <EOL> new += int ( char ) ** <NUM_LIT:2> <EOL> return new </s>
