Checkpoint — Strings
Pass the graded problem to finish the strings module.
Checkpoint — chuỗi. Pass the graded challenge below. The classic
implementation is expansion around every center: 2n-1 centers (each
character, and each gap between characters), each expanding while the
mirrored characters match — O(n^2) total, fine for n = 1000. The
near-miss everyone writes at least once is checking only the character
centers and forgetting the gaps — every even-length palindrome
(bb, abba) then goes uncounted.
Điểm kiểm tra — chuỗi. Pass bài chấm bên dưới. Cài đặt kinh điển là
nở quanh mọi tâm: 2n-1 tâm (mỗi ký tự, và mỗi khe giữa hai ký tự), mỗi
tâm nở trong khi các ký tự đối xứng vẫn bằng nhau — tổng O(n^2), ổn với
n = 1000. Near-miss mà ai cũng viết ít nhất một lần là chỉ kiểm tra tâm
ký tự mà quên các khe — mọi xâu đối xứng chẵn (bb, abba) sẽ bị bỏ
sót.