title: Given a non-negative integer N, returns the number of non-negative integers similar to N in Python
body: <p>Develop a function:</p>
  <p>Two non-negative integers N and M are said to be similar if their decimal representations can be obtained from each other by rearranging their digits. Note that a correct decimal representation does not contain leading zeroes.</p>
  <pre><code>Class solution { public int solution(int N); }
  </code></pre>
  <p>that, given a non-negative integer N, returns the number of non-negative integers similar to N.</p>
  <p>For example, given N =1213 the function should return 12 because there are twelve integers similar to 1213, namely: 1123, 1132, 1213, 1231, 1312, 1321, 2113, 2131, 2311, 3112, 3121, and 3211</p>
  <p>Given N = 123 the function should return 6 because there are six integers similar to 123, namely: 123, 132, 213, 231, 312 and 321</p>
  <p>Given N = 100, the function should return 1 because there is only one similar integer. 001 and 010 are both incorrect decimal representations of integers.</p>
  <p>Given N = 0 the function should return 1 because there is only one similar integer (the number itself).</p>
  <p>Currently, I have a function that creates all the permutations though I have more then 12 for N = 1213. I dunno how they exactly get this number.</p>
  <pre><code>def solution(N):
    
     res = [int(x) for x in str(N)] 
     result_perms = [[]]
     
     for n in res:
         new_perms = []
         for perm in result_perms:
           for i in range(len(perm)+1):
             new_perms.append(perm[:i] + [n] + perm[i:])
             result_perms = new_perms
     return result_perms
     
  </code></pre>