Pergunta de entrevista da empresa Nest

First question I was handed a laptop with Xcode running on it. The assignment was to write a super simple browser app that used substitution (or "regular expression", as the interviewer referred to it) to replace any instances of the word "Nest" with something arbitrary (e.g. I chose something like the name "Glassdoor").

Resposta da entrevista

Sigiloso

5 de fev. de 2016

I think this problem was probably simply meant as a way to test out if the candidate even knew how to do iOS & Xcode. I started off by writing a synchronous version of the app, where the app would take the URL entered into a text box above the web view and then load the HTML from the URL into a mutable string object which I did the substitution on). The interviewer then had me refactor things to be somewhat more asynchronous (e.g. using dispatch_async calls which called the HTML loading routine, and after the substitution was done, I did a separate dispatch_async call to the main (UI) thread to actually load the web view. The key to getting this to work (which was provided as a small hint by the interviewer) was that the string to be substituted (Nest) was case sensitive. If it had been case insensitive, horrendous things and style glitches could have happened when nest.com URL's were replaced with my arbitrary strings.