2014年8月1日 星期五

LeetCode OJ - Length of Last Word (C++) (try 7 times)

為了練習尋找實習時會碰到的問題,我用別人推薦的 LeetCode online judge。
希望能直接寫程式,不用事先編譯就能直接AC。
這是下面是我寫的 Climbing Stairs 的解法。

To practice future interview question, I use LeetCode online judge.
I am trying to type code directly on website without compile in other tool.
The following program is my Length of Last Word solution.

編譯錯誤次數 Compile Error number: 1
嘗試次數 Try number: 7 (AC: 2) (WA: 5)
是否事先在其他工具編譯 if compile first in other tool: No

使用的程式語言 using programming language: C++
以前是否看過 seen this problem before: No


WA原因:沒有考慮全部的狀況,全部狀況如下
1. string最前面有空白 
2. string最後面有空白
3. 只有一個詞,前後無空白
4. 空字串

If you want to use (copy, paste or quote) my original article, please contact me through email. (autek.roy@gmail.com) If there is any mistake or comment, please let me know. :D

如要使用(複製貼上或轉載)作者原創文章, 請來信跟我聯絡。(autek.roy@gmail.com) 如果有發現任何的錯誤與建議請留言或跟我連絡。 : )

沒有留言:

張貼留言

請留下您的任何想法或建議!
Please leave any thought or comment!