r/compsci • • May 17 '19

20+ String Coding Interview Questions for Programmers

https://hackernoon.com/20-string-coding-interview-questions-for-programmers-6b6735b6d31c
113 Upvotes

41 comments sorted by

View all comments

19

u/icendoan May 17 '19

strings are an array of characters

Not in utf8, they're not. Ascii is not the be all and end all.

5

u/quentech May 17 '19

What runtimes store strings in memory as utf8?

3

u/czdl May 17 '19 edited May 17 '19

Cocoa / OSX

Windows uses UTF16 which has exactly the same issue.

1

u/Nerdlinger May 17 '19

I believe Objective C/NSString still uses UTF-16 for the backing store, though Swift recently switched to UTF-8.

1

u/czdl May 18 '19

Perhaps on iOS, but querying NSString for its representation, or pulling bytes out on OSX reveals UTF-8.