# Task

**_Given_** a **_list of digits_**, *return the **_smallest number_** that could be formed from these digits, using the digits only once (ignore duplicates).* 
___

# Notes:

* Only **_positive integers_** *will be passed to the function (> 0 ), no negatives or zeros.*
___
# Input >> Output Examples 

```
minValue ({1, 3, 1})  ==> return (13)
```
## Explanation:
**_(13)_** *is the minimum number could be formed from* **_{1, 3, 1}_** , *Without duplications*  
___
```
minValue({5, 7, 5, 9, 7})  ==> return (579)
```
## Explanation:
**_(579)_** *is the minimum number could be formed from* **_{5, 7, 5, 9, 7}_** , *Without duplications* 
___

```
minValue({1, 9, 3, 1, 7, 4, 6, 6, 7}) return  ==> (134679)
```
## Explanation:
**_(134679)_** *is the minimum number could be formed from* **_{1, 9, 3, 1, 7, 4, 6, 6, 7}_** , *Without duplications* 
___
___

## [Playing with Numbers Series](https://www.codewars.com/collections/playing-with-numbers)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)

# [Bizarre Sorting-katas](https://www.codewars.com/collections/bizarre-sorting-katas)

# [For More Enjoyable Katas](http://www.codewars.com/users/MrZizoScream/authored)
___

## ALL translations are welcomed

## Enjoy Learning !!
# Zizou

Difficulty: introductory

Starter code:

def min_value(digits):
	

Solutions:
def min_value(digits):
     return int("".join(map(str,sorted(set(digits)))))


def min_value(digits):
    return int("".join(str(x) for x in sorted(set(digits))))

def min_value(digits):
    l = list(set(digits))
    l.sort(reverse=True)
    return sum(x * 10**i for i, x in enumerate(l))

def min_value(digits):
    return int("".join(str(i) for i in sorted(set(digits),reverse=False)))

def Remove(duplicate):
    result = []
    for num in duplicate:
        if num not in result:
            result.append(num)
    return result
    
def min_value(digits):
    digits = Remove(digits)
    digits = sorted(digits)
    min = ''
    for i in digits:
        min += str(i)
    return int(min)     

def merged(a,b):
    ac=0
    bc=0
    ra=[]
    while True:
        if ac<len(a) and bc<len(b):
            if a[ac]<b[bc]:
                ra.append(a[ac])
                ac=ac+1
            else:
                ra.append(b[bc])
                bc=bc+1
        elif ac<len(a):
            ra.append(a[ac])
            ac=ac+1
        elif bc<len(b):
            ra.append(b[bc])
            bc=bc+1
        else:
            break
    return ra
def mysort(arr):
    if len(arr)<2:
        return arr
    else:
        mid=len(arr)//2
        part1=mysort(arr[:mid])
        part2=mysort(arr[mid:])
        return merged(part1,part2)
def min_value(digits):
    d={}
    for x in digits:
        d[x]=0
    d=list(d.keys())
    d=mysort(d)
    ans=0
    for x in d:
        ans=(ans*10)+x
    return ans

def min_value(d):
    L=[]
    for i in d:
        if i not in L:
            L.append(i)
    L.sort()
    L1=[]
    for i in L:
        L1.append(str(i))
    return int("".join(L1))

def min_value(digits):
    sorted_digits = sorted(set(digits))
    result = ""
    for member in sorted_digits:
        result += str(member)
    return int(result)


def min_value(digits):
    digits = int(str(((((''.join(str((sorted(set(digits))))).strip(',')).strip('[')).strip(']')).replace(',',''))).replace(" ",''))
    return digits

def min_value(digits):
    unique_digits = []
    digits.sort()
    for i in digits:
        if i not in unique_digits:
            unique_digits.append(i)
    return int(''.join(str(e) for e in unique_digits))

def min_value(digits):
    return int(''.join(str(e)for e in sorted(dict.fromkeys(digits))) )

def min_value(digits):
    numbers = [False for x in range(10)]
    for x in digits:
        numbers[x] = True
    result = 0
    min = 1
    for i in range(9,0,-1):
        if numbers[i]:
            result += i*min
            min *= 10
    return result

min_value=lambda l:int(''.join(sorted(set(map(str,l)))))

def min_value(digits):
    unique_sorted_d = sorted(set(digits))
    return int(''.join(map(str, unique_sorted_d)))

def min_value(digits):
    return int(''.join(sorted(set(str(x) for x in digits))))

def min_value(lst):
    min_num = ""
    min_lst = []
    for i in range(len(lst) - 1):
        for j in range(len(lst) - 1):
            if lst[j] > lst[j + 1]:
                lst[j + 1], lst[j] = lst[j], lst[j + 1]
    for i in range(len(lst)):
        if lst[i] not in min_lst:
            min_lst.append(lst[i])
    for i in min_lst:
        min_num += str(i)
    return int(min_num)

def min_value(digits):
    # your code here
    return int(''.join(sorted({str(m) for m in digits})))

def min_value(digits):
    numbers = [0,1,2,3,4,5,6,7,8,9]
    num=[]
    for i in numbers:
        if i in digits:
            num.append(i)
    string = ""
    for i in num:
        string += str(i)
    return int(string)


from functools import reduce; min_value=lambda d: reduce(lambda a,b: a*10+b, sorted(set(d)))

def min_value(digits):
    new_digs = sorted(set(digits))
    a = ''
    for x in new_digs:
        a += str(x)
    return int(a)


min_value = lambda digits: int(''.join(sorted(list(map(str, set(digits))))))

def min_value(d): return int("".join(map(str, sorted(list(dict.fromkeys(d))))))


from itertools import permutations


def min_value(digits):
    return sum(v * 10 ** i for i, v in enumerate(reversed(min(list(permutations(set(digits)))))))

def min_value(a):
    a = list(dict.fromkeys(a))
    a.sort()
    a = int(''.join(map(str, a)))
    return a

def min_value(digits):
    return int(''.join(str(s) for s in sorted(set(digits))))

def min_value(digits):
  r=0
  for n in sorted(list(set(digits))): r=r*10+n
  return r

def min_value(digits):
    s=list(set(digits))
    s.sort()    
    t=0
    for i in s:
       t= 10*t + i
    return t

from itertools import permutations

def min_value(digits):
    digits = list(set(digits))
    digits.sort()
    str_array = list(map(str, digits))
    num_string = ''.join(str_array)
    return int(num_string)
    


def min_value(digits):
    dSet = sorted(set(digits))
    outStr = ""
    for i in dSet:
        outStr +=str(i)
    return int(outStr)

def min_value(digits):
    res = 0
    for item in sorted(set(digits)):
        res = res * 10 + item
    return res

def min_value(digits):
    temp = sorted(list(set(digits)))
    for i in range(len(temp)):
        temp[i] = str(temp[i])
    return int("".join(temp))

def min_value(digits):
    digits=sorted(set(digits))
    return int("".join(str(x) for x in digits))

def min_value(digits):
    array = sorted(list(set(digits)))
    return int("".join([str(i) for i in array]))


def min_value(digits):
    set_n = set()
    for i in digits:
        set_n.add(i)
    arr = []
    for i in set_n:
        arr.append(str(i))
    arr = sorted(arr)
    return int("".join(arr))

def min_value(d):
    return int(''.join([str(i) for i in sorted([*{*d}])]))

def min_value(digits):
    digits.sort()
    digits = list(dict.fromkeys(digits))
    
    if digits[0] == 0:
        aux = digits[0]
        digits[0] = digits[1]
        digits[1] = aux
    
    number = 0
    for i in digits:
        number = number * 10 + i
    
    return number

def min_value(digits):
    d = "".join([str(i) for i in sorted(list(set(digits)))])
    return int(d)

def min_value(digits):
    # your code here
    digits = list(set(digits))
    digits = sorted(digits)
    digits = [str(i) for i in digits]
    digits = ''.join(digits)
    return int(digits)

def min_value(digits):
    digits = list(dict.fromkeys(digits))
    print(digits)
    res = ""
    for i in list(sorted(digits)):
        res += str(i)
    return int(res)

def min_value(digits):
    digits = set(digits)
    ord = sorted(digits)
    new = ""
    for i in ord:
        new += str(i)
    return int(new)

def min_value(digits):                  
    newDigits = []
    for i in digits:
        if i not in newDigits:
            newDigits.append(i)
    sortDigits = sorted(newDigits)
    strDigits = ([str(i) for i in sortDigits])
    return int(''.join(strDigits))

def min_value(digits: list) -> int:
    """"This function returns the smallest number that could be formed from these digits, using the digits only once (ignore duplicates)."""
    my_arr = []
    for item in digits:
        if item not in my_arr:
            my_arr.append(item)
    return int(''.join(map(str, sorted(my_arr))))

def min_value(digits):
    unique_digits = set(digits)
    min_number = 0
    for integer in sorted(unique_digits):
        min_number *= 10
        min_number += integer
    return min_number


def min_value(digits):
    x = sorted(set(digits))
    y = [str(a) for a in x]
    return int(''.join(y))

def min_value(digits):
    return int(''.join(sorted(set(map(str,digits)), key = int)))

def min_value(digits):
    s=set()
    for x in digits:
        for d in str(x):
            s.add(d)
    return int(''.join(sorted(s)))

def min_value(digits):
    # your code here
    
    nums = sorted(list(set(digits)))
    s = ''
    
    for i in nums:
        
        s += str(i)
    return int(s)



def min_value(digits):
    # your code here
    
    set_digits = set()
    for digit in digits:
        set_digits.add(digit)
    sorted_digits = sorted(set_digits)
    interim = "".join((list(map(str,sorted_digits))))
    return int(interim)



def min_value(digits):
    digits = sorted(set(digits))
    strings = [str(integer) for integer in digits]
    return int("".join(strings))

def min_value(digits):
    y = sorted(list(set(digits)))
    x =  [str(i) for i in y]
    return int("".join(x))

from functools import reduce
from operator import concat

def min_value(digits):
    return int(reduce(concat, map(str,sorted(set(digits)))))

def min_value(digits):
    # your code here
    new = sorted(digits)
    i = 0
    j = i + 1
    nodup = []
    stri = ''
    for i in new:
        if i not in nodup:
            nodup.append(i)
    for i in nodup:
        stri += str(i)
        
    return int(stri)
        
        


def min_value(digits):
    list_1 = []
    for i in digits:
        list_1.append(i)
    
    final_list = list(set(list_1))
    
    final_list.sort()
    print(final_list)
    str_nums = [str(x) for x in final_list]
    print(str_nums)
    lowest_number = ''.join(str_nums)
    lowest_number = int(lowest_number)
    
    return lowest_number
    
  


def min_value(digits):
    digits = sorted(set(digits), reverse=True)    # Remove duplicated and then sort the result
    return sum(d * 10**i for i, d in enumerate(digits))

def min_value(digits):
    a = sorted(set(digits))
    b = []
    for i in range(len(a)): b.append(str(a[i]))
    return int(''.join(b))

def min_value(digits):
    set_digits = sorted(set(digits))
    str_smallest = ""
    for i in set_digits:
        str_smallest = str_smallest + str(i) 
    return(int(str_smallest))
    # your code here


def min_value(digits):
    num1 = ""
    digits = sorted(digits)
    stringints = [str(int) for int in digits]
    for i in stringints:
        if i not in num1:
            num1 += i
    return (int(num1))

def min_value(digits):
    b = []
    a = [b.append(i) for i in digits if i not in b]
    b.sort()
    return int(''.join(str(i) for i in b))

def min_value(digits):
    storage = []
    for scan in digits:
        if str(scan) not in storage:
            storage.append(str(scan))
    storage.sort()
    return int("".join(storage))
    # your code here


def min_value(i):
    dups = []
    for elem in i:
        if elem not in dups:
            dups.append(elem)
    dups = sorted(dups)
    return int(''.join(map(str,dups)))
        


def min_value(digits):
    a = set(digits)
    a = sorted([str(i) for i in a])
    return int(''.join(a))

def min_value(digits):
    digits = sorted(list(dict.fromkeys(digits))) #removes duplicates and sorts the list
    digits = ''.join(list(map(str,digits))) #converts the list into a string
    return int(digits) #converts the string into an integer


def min_value(digits):
    digits_arr = []
    minimum = ''

    for i in range(len(digits)):
        digits_arr.append(int(digits[i]))
    
    sorted_arr = sorted(set(digits_arr))
    
    for j in range(len(sorted_arr)):
        minimum += str(sorted_arr[j])
    
    return int(minimum)

def min_value(digits):
    result = []
    l = [i for i in set(digits)]
    while len(l) > 0:

        result.append(str(l.pop(l.index(min(l)))))

    return int(''.join(result))

def min_value(digits):
    # your code heredef codewar (stuff):
    z = ''
    n = (digits) 

    y = []
    for x in n:
        if x in y: continue
        y.append(x)
        y.sort()
    for x2 in y:
            z = z + str(x2)
    print(z)
    return(int(z))


def min_value(digits):
    list =[]
    list2 =[]
    ans = ""
    for i in digits:
        if i not in list:
            list.append(i)
            list2 = sorted(list)
    for i in list2:
        ans = ans +str(i)
    return int(ans)

def min_value(digits):
    nodupe = list(set(digits))
    j = len(nodupe)
    output = 0 
    nodupe.sort()
    
    for i in nodupe:
        output += i * pow(10,j - 1)
        j -= 1
        
    return output

def min_value(digits):
    # your code here
    lostlist = ""
    for i in sorted(list(set(digits))):
        lostlist += str(i)
    return int(lostlist)

def min_value(digits):
    st = ""
    calc  = sorted(list(set(digits)))
    for nums in calc:
        st = st + str(nums)
    return int(st)


def min_value(digits):
    return int(''.join(map(str,(sorted(set(map(int,digits)))))))

def min_value(digits):
    digits.sort()

    print(digits)
    i=0
    while i <= len(digits)-2:
        print(i)
        if digits[i] == digits[i+1]:
            digits.pop(i)
            
            print(digits)
        else :
            print(digits)
            i+=1
    s = ""
    for x in digits:
        s += str(x)
    return int(s)



def min_value(digits):
    digits = sorted(list(set(digits)))
    result = ""
    for x in range(len(digits)):
        result += str(digits[x])
    return int(result)

def min_value(digits):
    noDuplicates = list(set(digits))
    sortedDigits = sorted(noDuplicates)
    
    return int(''.join([str(x) for x in sortedDigits]))

def min_value(digits):
    value = ''
    digits = set(digits)
    digits = sorted(digits)
    for digit in digits:
        value += str(digit)
    return int(value)


def min_value(digits):
    x=list(set(digits))
    x.sort()
    return int("".join(str(x) for x in x))

def min_value(digits):
    new_digits = list(set(digits))
    new_digits.sort()
    res = int("".join(map(str, new_digits)))
    return res

def min_value(digits):
    return int(''.join(sorted([str(digit) for digit in set(digits)])))

def min_value(digits):
    digits = list(set(digits))
    res = ''
    while len(digits) > 0:
        min_num = min(digits)
        res += str(min_num)
        digits.remove(min_num)
    return int(res)

def min_value(digits):
        return int("".join(repr((n)) for n in sorted(set(digits))))


def min_value(digits):
    a= []
    for i in range(len(digits)):
        if digits[i] not in a:
            a.append(digits[i])
    return int("".join(repr((n)) for n in sorted(a)))


def min_value(digits):
    list=[]
    for x in sorted(set(digits)):
        if x > 0:
            list.append(x)
    return int(''.join(map(str,list)))

import heapq
def min_value(digits):
    lista = []
    output = []
    for i in digits:
        if i not in lista:
            lista.append(i)
    heap = heapq.nsmallest(99,lista)
    heap_string = [str(i) for i in heap]
    convert = "".join(heap_string)
    return int(convert)


def min_value(digits):
    for i in range(0, len(digits)):
        digits[i] = str(digits[i])
    digits = set(digits)
    digits = sorted(list(digits))
    return int("".join(digits))

from itertools import permutations
def min_value(digits):
    b=[]
    a=list(permutations(set(digits)))
    for x in a:
        x=[str(y) for y in x ]
#         print(x)
        b.append(int(''.join(x)))
    return min(b)
     


def min_value(digits):
    digitsSet = set(digits) 
    listDigits = list(digitsSet)
    listDigits.sort()
    
       
    ans = str(list(listDigits)).replace("[","").replace("]","").replace(", ","")
    return int(ans)

def min_value(digits):
    digits = sorted(set(digits), reverse=True)
    return sum(n * 10**i for i, n in enumerate(digits))


def min_value(digits):
    if len(digits) > 1:
        # Sort ascending order
        digits.sort()
        
        # Remove duplicats from list
        output = []
        counter = 1
        for i in digits:
            if i != digits[counter]:
                output.append(i)
            if counter != len(digits) - 1:
                counter += 1
        output.append(digits[-1])
            
        # Turn integers to string and join
        output = [str(i) for i in output]
        output =int(''.join(output))
        return output
    return digits[0]
    
    


def min_value(digits):
    l = sorted(str(x) for x in set(digits))
    return int("".join(l))


def min_value(digits):
    number = list(dict.fromkeys(digits))
    number.sort()
    return int(''.join(str(i) for i in number))

def min_value(d):
    dd = sorted(list(set(d)))
    smallest = dd[0]
    for i in range(1, len(dd)):
        smallest *= 10
        smallest += dd[i]
    return smallest

def min_value(digits):
    str_list = []
    stringulator = ""
    d_list = list(dict.fromkeys(digits))
    sorted_list = sorted(d_list)
    for s in sorted_list:
        stringulator += "{}".format(s)
    result = int(stringulator)
    return result

def min_value(digits):
    min = ""
    dig2 = list(dict.fromkeys(digits))
    dig2.sort()
    for i in dig2:
        min = min+str(i)
    return int(min)


def min_value(digits):
    # your code here
    empty = []
    string=""
    for i in digits:
        if i not in empty:
            empty.append(i)
    empty.sort()
    
    for x in empty:
        string += str(x)
    return int(string)


def min_value(digits):
    s = ''
    ans = []
    digits.sort()
    new_digits = set(digits)
    for i in new_digits:
        ans.append(i)

    ans.sort()
    for i in ans:
        s += str(i)
        
    return int(s)

def min_value(digits):
    s = ""
    for i in sorted(digits):
        if str(i) not in s:
            s += str(i)
    return int(s)