Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

yes that's how I first read it but I got less sure that was meant as I read the rest.

For example it looks to me like it thinks fhtagnblue which has the words tag and blue in it should return true? Maybe I'm reading things wrong - but if it should return true, thus allowing fragments, then every word with two letters or more would return true because every letter is a noun.

If it is as you said, which might be actually interesting thing to do and potentially even useful, I might not want to do it with a query this dictionary for a string and instead have actual access to the dictionary to work with since I figure an optimized solution can be made with binary search.

on edit: I mean considering Google's reputation for trick questions and logic gotchas I would probably just say "wow you guys really are like that" and write something like

if(!s) {return false;} s_array = s.split(""); return s_array.length > 1;



oops but then I just realized what if string has numbers in it. I guess I would spend time trying to catch the different edge cases in my understanding of the question and at the end he would be like this guy struggled and did it wrong, when I just think they don't know letters are nouns.

on edit: hmm, a number is also a noun so I guess if query(9) or query("9") worked wouldn't have a problem, but then if it didn't I would have to say hey your dictionary is broken and then there would probably be discussions. But since it is all just hypothetical I suppose I could assume that the dictionary isn't broken and so any trimmed string with more than two characters in it would still return true.


If it had numbers I think you could immediately assume it is not 2 words.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: