1271. Hexspeak Updated: 2024-03-12 1 min read Algorithms , LeetCode On This PageLeetCode problem 1271class Solution: def toHexspeak(self, num: str) -> str: s = set('ABCDEFIO') t = hex(int(num))[2:].upper().replace('0', 'O').replace('1', 'I') return t if all(c in s for c in t) else 'ERROR'