Timeline for Palindrome program with reverse method
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 17, 2013 at 10:50 | comment | added | 200_success | The initial prompt belongs before the loop. | |
Dec 17, 2013 at 7:16 | comment | added | Ihor Kaharlichenko |
I wouldn't suggest using do-while here. Not that do-while is bad as such, but having an ok flag isn't any better. To me the approach by @raistlinthewizard (using continue) is way more elegant.
|
|
Dec 17, 2013 at 4:43 | history | edited | rolfl | CC BY-SA 3.0 |
improve formatting
|
Nov 5, 2013 at 15:36 | vote | accept | Gandalf | ||
Nov 5, 2013 at 13:05 | comment | added | rolfl |
Other people have already suggested answers for those questions. My notes are purely on the main method. As for your specific questions, I have used the OP's isPalindome() method and I think it is a better method than using String (since it's easier to validate the int). Also, I have just copy/pasted the OP's code and moved it, keeping as much of his 'style' as I can. It is not my intention to criticize or compete against other answers here
|
|
Nov 5, 2013 at 12:56 | comment | added | cl-r |
How do you code isPalindrom(Integer) method? - Why are you transforming the input in a int ? keep it as String : (s==null || s.startwith('-') || s.length <2 ) --> false; is also a good test to protect StringBuilder method
|
|
Nov 5, 2013 at 11:39 | history | answered | rolfl | CC BY-SA 3.0 |