3 ms·
Edge cases such as "1oneight", "3sevenine", "sevenine3" (I made these up to highlight)
by Frummy 3y ago
Edge cases such as "1oneight", "3sevenine", "sevenine3" (I made these up to highlight)
- mqus 3y agoThanks! I thought I had the most straight-forward code there is and there were no edge cases that I hit. But I didn't use regex or something, just manual pattern matching like gp. Imho regexes are overused for such stuff, precisely because they might do a lot of things you don't think about and are usually a lot slower than manually implementing what you want.
- sokoloff 3y agoI’d wager that most implementations would be fine on “sevenine3”, as they’d likely get 73 for the row, whether or not they found the 9.
- Frummy 3y agoIf they have functions that for example reads from forward then backward or vice versa while changing the structure of the row, one test will pass but the other won't. It's a lot of rows in the input and it took a lot of time for me personally to debug to understand what went wrong
- criddell 3y agoHow about just "sevenine"?