roman-numerals/solution.go: 4 prints IIII and 1994 prints MDCCCCLXXXXIIII (no subtractive forms)
Maintainer antworten meist innerhalb von 1 Tag
Ein zugehöriger Pull Request wurde bereits gemerged.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
The bug is in problems/roman-numerals/solution.go, which emits additive forms like IIII and VIIII; problems/roman-numerals/solution.py already gives MCMXCIV for 1994 and is a reference. Add the subtractive inputs (3, 8, 2026, 1500, 3888) to cases.txt and run python3 run.py roman-numerals. Done means the Go output matches the README examples. Two open pull requests (#28, #34) already target this, so check them before starting.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
What I did
- Fresh checkout of
main, Go installed. - Run the Go solution on the README's own examples:
echo 4 | go run problems/roman-numerals/solution.go
echo 9 | go run problems/roman-numerals/solution.go
echo 40 | go run problems/roman-numerals/solution.go
echo 1994 | go run problems/roman-numerals/solution.go
echo 3999 | go run problems/roman-numerals/solution.go
- For comparison, the Python solution on the same inputs:
echo 1994 | python3 problems/roman-numerals/solution.py
What I expected
The problem README says: "Use the subtractive forms: 4 is IV, 9 is IX, 40 is XL, 90 is XC, 400 is CD and 900 is CM. So 1994 is MCMXCIV." (problems/roman-numerals/README.md)
So IV, IX, XL, MCMXCIV and MMMCMXCIX.
What happened instead
4 -> IIII
9 -> VIIII
40 -> XXXX
1994 -> MDCCCCLXXXXIIII
3999 -> MMMDCCCCLXXXXVIIII
The Python solution prints MCMXCIV for 1994. The Go solution is wrong for 1952 of the numbers from 1 to 3999. python3 run.py roman-numerals passes today only because cases.txt does not include any input that needs a subtractive form (3, 8, 2026, 1500, 3888).
Environment
code-corner main @ 81bb5dc, Go 1.27, Windows 11.
I'd like to work on the fix for this, and add the failing inputs to cases.txt as the Contributing section asks.
- Vorherrschende Sprache
- Python
- Sterne
- 1
- Forks
- 6
- Ø Merge
- 17 Std. 52 Min.
- Gemergte PRs (30 T.)
- 14
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus techcsispit/code-corner
-
prime/solution.java doesn't compile: public class PrimeCheck in solution.java, README requires Solution.java with a Solution classEvtl. vergeben @tanujb03 hat das vor 1 Tag übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
techcsispit/code-corner#35 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Prime solution in C++ incorrectly returns true for some composite numbersEvtl. vergeben @paramsj hat das heute übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 25/100
techcsispit/code-corner#38 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Failed compilations always report 0.000 secondsEvtl. vergeben @Shivangi-singh18 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
techcsispit/code-corner#37 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
run.py: Python solutions are skipped on Windows when run via python instead of python3Evtl. vergeben @tanujb03 hat das vor 1 Tag übernommen. Offenbug good first issue
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 15/100
techcsispit/code-corner#29 ·
Maintainer antworten meist innerhalb von 1 Tag
-
fibonacci/solution.c: prints negative numbers for n of 47 or more (F(90) prints -1581614984)Evtl. vergeben @tanujb03 hat das vor 1 Tag übernommen. Offenbug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 25/100
techcsispit/code-corner#27 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in techcsispit/code-corner
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
vllm-project/vllm#61131 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
kubernetes-client/python#2735 ·
Maintainer antworten meist innerhalb von 1 Tag
-
desktop help wanted test
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
docs pydanty:is-working
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
pydantic/pydantic-ai#10113 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Tutorial unit test leaks sample data into tutorial doctestEvtl. vergeben @Gambit-Checkmate hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100