We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The Time in Words
The Time in Words
Sort by
recency
|
960 Discussions
|
Please Login in order to post a comment
Live by the library, die by the library I guess.
I was working with Swift, and Foundation has a spell out style number formatter. So I decided to use it.
Passed all the "open" test cases, failed two of the locked ones. Made the example section into another batch of test cases, and low and behold I was generating "twenty-eight minutes past five" and the example had no dash.
So anyone else deciding to save time by using the built in Foundation number formatter (hey if it were a real world job I would be upset at a PR trying to spell out numbers and not just using the libary without good reason!) should be aware they need to post process hyphens into spaces....
Live by the library, die by the library I guess.
I was working with Swift, and Foundation has a spell out style number formatter. So I decided to use it.
Passed all the "open" test cases, failed two of the locked ones. Made the example section into another batch of test cases, and low and behold I was generating "twenty-eight minutes past five" and the example had no dash.
So anyone else deciding to save time by using the built in Foundation number formatter (hey if it were a real world job I would be upset at a PR trying to spell out numbers and not just using the libary without good reason!) should be aware they need to post process hyphens into spaces....
My python solution:
def timeInWords(h, m):
Nice — solving the same problem in five languages is a great way to compare idioms. Below I’ll give concise, actionable feedback you can apply to each implementation (correctness, edge cases, style, tests), plus language-specific tips. 11xplay Sign Up
My java solution. Not all tests pass and i don't understand why. If i test them by hand they pass, but sending solution makes them not pass (for example test 2)
class Result {
}
Not all