The brief
you can't edit the code — only instruct the AIsort_versions(versions)
- Sorts version strings ascending by their numeric parts —
1.10.0comes after1.9.0. - A tagged version sorts before the same plain version:
2.0.0-rc<2.0.0. Tags compare as text. - Missing segments count as 0 (
1.2=1.2.0). Return a new array; equal versions keep their order.
sort_versions(["1.10.0", "1.9.0"]) → ["1.9.0", "1.10.0"]
current code — written by the AI
function sort_versions(versions) {
// Sort version strings ascending.
return versions.slice().sort();
}
6 hidden cases · 1 shown
Drive the AI
it does exactly what you sayDrive me to fix sort_versions so it passes the hidden tests. I do exactly what you tell me — nothing more — so be precise. Every message costs tokens; fewest tokens wins. Par is 650. Hit “Run tests” whenever you want to check.
token spend vs par0 / 650