Timeline for LeetCode: Longest String Chain (Java)
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 21, 2020 at 16:24 | comment | added | Martin Frank | Very nice @Maarten Bodewes... Honestly I was quite a bit eager when I wrote my answer. The missing data type just pained me, so I shot and asked afterwards... Stupid me... | |
Feb 21, 2020 at 16:20 | comment | added | Maarten Bodewes |
Something that really got me, even though it is very minimal, is breakReached = true; -> after the loop, if no break is reached, then the last character only differs, right? So success & stop! (but I upvoted for the design, because the errors don't invalidate it).
|
|
Feb 21, 2020 at 16:17 | comment | added | Martin Frank | @Maarten Bodewes you are absolutely right. Here is even more code review to do than on the original question. I should have sticked with a more minimal answer, where I only point out the flaw of the design... | |
Feb 21, 2020 at 15:16 | comment | added | Maarten Bodewes | This design is a ton better, but it really requires its own code review, to be honest. | |
Feb 21, 2020 at 15:09 | comment | added | Maarten Bodewes |
Or make that Predecessor.isPredecessorOf(String successor) I guess.
|
|
Feb 21, 2020 at 14:54 | comment | added | Maarten Bodewes |
That should be isSuccessor() the way you wrote it. The predecessor is the smaller of the words, and you compare to #word + 1 .
|
|
Feb 21, 2020 at 14:20 | comment | added | Martin Frank |
k think it's called primitive obsession when you prefer primitive datatype Map<String, Integer> over a proper data type.
|
|
Feb 21, 2020 at 14:11 | history | answered | Martin Frank | CC BY-SA 4.0 |