not using buffer to save b/op

This commit is contained in:
Branden Colen
2021-04-02 11:47:47 -05:00
parent a814f4356c
commit 168b572a55
2 changed files with 17 additions and 9 deletions
+3 -3
View File
@@ -53,14 +53,14 @@ func outOfBounds(input int) bool {
}
func intToRoman(input int) []byte {
output := bytes.Buffer{}
var output []byte
for _, rom := range _numerals {
for input >= rom.val {
output.Write(rom.sym)
output = append(output, rom.sym...)
input -= rom.val
}
}
return output.Bytes()
return output
}
// StringToInt converts a roman numeral string to an integer. Roman numerals for numbers