11# class Solution(object): 
2- #     def intToRoman(self, num) : 
2+ #          def intToRoman(self, num: int) -> str : 
33#         """ 
44#         :type num: int 
55#         :rtype: str 
66#         """ 
77# 
88class  Solution (object ):
9-     # def intToRoman(self, num) : 
10-     #      # http://www.rapidtables.com/convert/number/how-number-to-roman-numerals.htm
11-     #      roman_dim = [[1000, 'M'], [900, 'CM'], [500, 'D'], [400, 'CD'],
12-     #                    [100, 'C'], [90, 'XC'], [50, 'L'], [40, 'XL'], [10, 'X'],
13-     #                    [9,'IX'], [5, 'V'], [4, 'IV'], [1, 'I']]
14-     #      if num == 0:
15-     #          return ''
16-     #      roman_str = ''
17-     #      current, dim = num, 0
18-     #      while current != 0:
19-     #          while current // roman_dim[dim][0] == 0:
20-     #              dim += 1
21-     #          while current - roman_dim[dim][0] >= 0:
22-     #              current -= roman_dim[dim][0]
23-     #              roman_str += roman_dim[dim][1]
24-     #      return roman_str
9+     # def intToRoman(self, num: int) -> str : 
10+         ##  http://www.rapidtables.com/convert/number/how-number-to-roman-numerals.htm
11+         #  roman_dim = [[1000, 'M'], [900, 'CM'], [500, 'D'], [400, 'CD'],
12+         #              [100, 'C'], [90, 'XC'], [50, 'L'], [40, 'XL'], [10, 'X'],
13+         #              [9,'IX'], [5, 'V'], [4, 'IV'], [1, 'I']]
14+         #  if num == 0:
15+         #      return ''
16+         #  roman_str = ''
17+         #  current, dim = num, 0
18+         #  while current != 0:
19+         #      while current // roman_dim[dim][0] == 0:
20+         #          dim += 1
21+         #      while current - roman_dim[dim][0] >= 0:
22+         #          current -= roman_dim[dim][0]
23+         #          roman_str += roman_dim[dim][1]
24+         #  return roman_str
2525
26-     def  intToRoman (self , num ) :
26+     def  intToRoman (self , num :  int )  ->   str :
2727        values  =  [1000 , 900 , 500 , 400 ,
2828                  100 , 90 , 50 , 40 ,
2929                  10 , 9 , 5 , 4 , 1 ]
@@ -34,7 +34,7 @@ def intToRoman(self, num):
3434        roman  =  '' 
3535        i  =  0 
3636        while  num  >  0 :
37-             k  =  num  /  values [i ]
37+             k  =  num  //   values [i ]
3838            for  j  in  range (k ):
3939                roman  +=  symbols [i ]
4040                num  -=  values [i ]
0 commit comments