I’ve been using an easier version of my coding question lately, because candidates have struggled so much. First I moved it from C to C# (or Java, if candidates only have a java background). Then I simplified it, a lot. The problem is simple: reverse a string using no outside libraries. This was an introductory-level when I interviewed at Microsoft but now it seems to be advanced!
I’ve had candidates waste 40, 50 lines of code answering this. They usually don’t answer the question at all (they won’t write the full function with signature, or they reverse any words w/o reversing the characters, etc.).
I tried it again last night against .NET 3.x—I wanted to make sure I wasn’t expecting too much--you know, maybe programming has changed while I’ve been in meetings! ;).
I ended up with a small challenge (converting my char[] so it returned a string—kept returning the object type), but other than that, this went really well. 15 lines of code, including curly braces and the step to convert from the input string into a char[] (no error handling; have to get to that next)
Is the question too difficult? Wanna take a stab? Can you beat 15 lines, without using string.Reverse()?
Hi John. Assuming you're attempting to hire programmers, what you're asking is not that difficult. Here's a 10-line Java version (sorry I didn't have C# installed):
ReplyDeletepublic String reverse(String s)
{
assert(s != null);
StringBuffer buf = new StringBuffer();
for (int i = s.length() - 1; i>=0; --i)
{
buf.append(s.charAt(i));
}
return buf.toString();
}
It's commonly known that there can easily be differences of 10x in programmer speed / effectiveness, as a Google search for "programmer productivity 10" shows. If a programmer can't handle that request in a couple of minutes, you probably don't want them programming for you.
At first glance my code above might seem fine, but in reality, it's not. Certain Unicode grapheme's can't fit into a single character (even though Java's char is 32-bits, with the lower 21 representing the actual character). Thus, I'd actually need to check to make sure that each character wasn't one of these two-part graphemes that would need to have the order remain intact. So, maybe it really is a harder question than I thought ;).
Hey Kaleb, good point on the unicode issue. That trips up a lot of people.
ReplyDeleteI also agree on the coding speed comment.
Nicely done and no, it shoudln't be that difficult.
人生最大的榮耀,不是永遠不敗,而是屢仆屢戰..................................................
ReplyDelete很榮幸能到你的BLOG留言o^~^o........................................
ReplyDelete破解色情守門人成人色情電影院線上免費色情短片色情動畫影成人色情動畫成人電影秀亞洲線上免費成人電影性片免費狂看性交線上免費影片性免費小說網性美女做愛性美女遊戲性教影片性教學影片性感乳房影片性感做愛電影性感援交妹性感電影性感劍士性愛a片免費試看性小遊戲幸愛影片姓愛圖貼亞洲線上免費電影亞洲線上免費影片其色制聊天室咆哮入口咆哮老鼠網咆哮鼠85cc聊天室情色視訊情色視訊
ReplyDelete只用微笑說話的人,才能擔當重任。..................................................
ReplyDelete好問才能博學。......................................................
ReplyDeletethank for share, it is very important . ̄︿ ̄..................................................
ReplyDeleteKK777一夜激情聊天live show成人自拍貼圖自慰少婦自拍裸體圖片台灣色情成人網站情人視訊網情色留言板視訊美女免費視訊聊天室限制級極度震撼情色論壇色情特區自拍裸女貼圖潮吹性影片觀賞小穴情色片a圖片sex story性愛影片美女做愛成人色情網站性愛圖片成人情色貼圖全裸寫真集圖片走光圖女生陰毛自慰影片色情av1007成人色情聊天室女生自慰裸體照成人影音聊天台灣色情網站色情片打手槍情色天堂成人視訊聊天免費情色網站av網超性感辣妹激突成人論壇情色視訊聊天鹹濕成人網站av成人論壇免費美女視訊
ReplyDelete非常感謝~3Q~....................................................
ReplyDelete與其期盼別人疼你,不如自己疼自己。 ....................................................
ReplyDelete我對自己的信心已超越別人對我的評價..............................
ReplyDelete85cc成人免費觀看 免費視訊影片 情色視訊聊天 免費av18影片 豆豆聊天交友論壇 女優光碟網 免費看性感影片 做愛影片! 偷拍實錄 UT視訊聊天室 女同志愛愛影片免費 色瞇瞇情趣用品網 18禁下載 少女脫衣秀遊戲 3d免費a影城 哪裡看a片 麗的情色網站 色情成人片 桃園一夜情留言板 383影音網 完美性交 玩美情人論壇 波波遊戲美女 動漫色辣妹 人妻 人妻熟女圖片 免費視訊 live173 a片分享區 巨乳美女寫真集 85cc倉井空 微風線上觀看區 ut聊天室 777成人 小魔女貼圖 援交電話 台灣情人網dvd 全裸鋼管秀 日本av免費 洪爺影城討論區 大奶美女圖貼 sex520貼片 情色電影下載 巨乳人妻 性愛光碟 後宮電影 成人圖庫 自拍0204貼圖 性愛貼圖自拍 模特兒走光圖
ReplyDelete喜歡這裡-支持你的更新..................................................
ReplyDeleteyou two make a lovely couple............................................................
ReplyDelete春冰薄,人情更薄;登天難,求人更難。 ............................................................
ReplyDeleteConstant dripping wears away the stone. 滴水穿石!加油!..................................................
ReplyDelete初次造訪,安安^^.................................................................
ReplyDelete欣賞是一種美德~回應是最大的支持^^.................................................................
ReplyDelete在莫非定律中有項笨蛋定律:「一個組織中的笨蛋,恆大於等於三分之二。」......................................................................
ReplyDelete當一個人內心能容納兩樣相互衝突的東西,這個人便開始變得有價值了。............................................................
ReplyDelete人有兩眼一舌,是為了觀察倍於說話的緣故。............................................................
ReplyDelete人生是故事的創造與遺忘。............................................................
ReplyDelete有夢最美啦~~加油!元氣滿點!............................................................
ReplyDelete下次再來希望可以看到新的作品喔。..................................................
ReplyDelete路過留言支持~~~............................................................
ReplyDelete多謝美味的心靈雞湯................................................................
ReplyDelete我在戀愛著?--------是的,因為我在等待著.................................................................
ReplyDelete真是太猛了,請受小弟一拜Orz(>O<)............................................................
ReplyDeleteMake hay while the sun shines...................................................
ReplyDelete生存乃是不斷地在內心與靈魂交戰;寫作是坐著審判自己。. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReplyDelete世間事沒有一樣沒有困難,只要有信心去做,至少可以做出一些成績。..................................................
ReplyDelete人逢順境不逞強,身處逆境不示弱。............................................................
ReplyDelete財富並非永遠的朋友,但朋友卻是永遠的財富。......................................................................
ReplyDelete很棒的分享~祝福你............................................................
ReplyDelete做好事,不需要給人知道,雖然只是一件微不足道的事,但我相信,這會帶給我快樂。..................................................
ReplyDelete祝福你人氣不減ˊˇˋ............................................................
ReplyDelete愛情是盲目的,但婚姻恢復了它的視力。......................................................................
ReplyDelete感謝分享~希望有更多的好文章分享給大家.................................[/url]...............
ReplyDelete我來湊熱鬧的~~^^ 要平安快樂哦..................................................
ReplyDeleteJohn: I'm writing from STP but didn't quickly have your email. Would you mind emailing me?
ReplyDeleteyhamilton@redwoodco.com
Your Blog is one of the best top 100 software testing blogs listed in this article:
ReplyDeletehttp://www.testingminded.com/2010/04/top-100-software-testing-blogs.html
but for me, it's just one of the best! Keep the great work!
------------------
If you plan to go in Cameroon, please visit: Offres d'emploi au Cameroun