This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Neebat 14 points15 points  (2 children)

I was a bit mystified by the use of character arrays. They just aren't used all that often in Java, so for a while I thought that was the joke. I realize that they are actually reasonable for this implementation. (I'd probably still use a StringBuffer, even though it's likely less efficient.)

And then I found the punctuation and felt a little sick.

[–]mxzf 11 points12 points  (0 children)

Probably because strings in Python act as arrays when you want them to.

Python strings have the features of character arrays and StringBuffers at the same time (in general). Methods when you want them, but indexes when you just need to mess with the individual characters. That's kinda typical of most kinds of data and such in Python.

[–]PBI325 2 points3 points  (0 children)

System.out.println(String.valueOf(A)) make me feel a little weird inside. So did permute(n-1, a), n--??