Tim Holloway wrote:
Dawid Smith wrote:
When it comes to actually practising, mirroring(reapeating after chosen person) worked for me much better than studying books about pronunciation.
You really shouldn't believe what books say, anyway. They frequently assert that certain sounds "don't exist" in Language X, but you can plainly hear them (although usually weakened) if you actually listen to native speakers.
And forget about pronouncing things as you read them. Virtually no languages pronounce exactly as written. Possibly excepting Standard Arabic, but that's a formal language, not a "natural" one. French is notorious for all the letters you don't pronounce, Polish managed to make "Lodz" pronounce as "wooz". Gaelic is a nightmare. And English is probably the grossest offender of them all, thanks to its habit of plundering words wholesale and more or less keeping their original spelling despite differences in how alphabets are used. And, of course due to the sound mutations over the centuries, even the native and Anglo-Saxon mother language contributions have only light correspondence to their present-day spelling.
salvin francis wrote:Have a cow for sharing your implementation with us.
Typically, I would have suggested comparing the index for equality first since if both indexes are same, then the comparison is not needed. However, I see that doing this wont achieve much difference.
I think that your implementation is good given the constraints of the problem specified. Ideally, I would suggest not calculating "ar.length/2" for every iteration since it does not change. A more simpler implementation would be to send a cropped copy of the array to the next recursive call instead of the pairLocation.
Paul Clapham wrote:
salvin francis wrote:The original question asks you to write: ...
Yes, the original post said
The method returns 1 if a is a palindrome, 0 otherwise.
But that's an icky design for Java, it looks like somebody was used to writing C and didn't know much Java. So I'd fully support returning a boolean value.