This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def int_to_aii_numeral(num): | |
# greedy approach similar to https://leetcode.com/problems/integer-to-roman/description/ | |
# time O(1) | |
# space O(1) | |
# based on the numerals here: https://en.wiktionary.org/wiki/Module:number_list/data/aii | |
numerals = [ | |
(1000, 'ܐ݇'), | |
(900, 'ܨ̈'), (800, 'ܦ̈'), (700, 'ܥ̈'), (600, 'ܣ̈'), (500, 'ܢ̈'), (400, 'ܬ'), | |
(300, 'ܫ'), (200, 'ܪ'), (100, 'ܩ'), (90, 'ܨ'), (80, 'ܦ'), (70, 'ܥ'), (60, 'ܣ'), |