# 查看完整版本 : LeetCode

Susan﹏汪汪 2016-7-19 07:28 AM

[quote]原帖由 [i]darigold[/i] 於 2016-7-18 11:13 PM 發表 [url=http://www.discuss.com.hk/redirect.php?goto=findpost&pid=444871752&ptid=24497948][img]http://www.discuss.com.hk/images/common/back.gif[/img][/url]

&- 這個operator好奇怪 …… [/quote]
+ - * operator有overflow checking
&+ &- &*會忽略overflow

[url=http://www.discuss.com.hk/iphone][img=100,23]http://i.discuss.com.hk/d/images/r10/iphoneD.jpg[/img][/url]

darigold 2016-7-28 12:30 PM

Susan﹏汪汪 2016-7-28 04:20 PM

[code]class Solution {
func reverseString(s: String) -> String {
return String(s.characters.reverse())
}
}[/code]

Susan﹏汪汪 2016-7-28 04:36 PM

C++ version[code]class Solution {
public:
string reverseString(string s) {
auto begin = s.begin();
auto rbegin = s.rbegin();
const auto end = s.end();
const auto rend = s.rend();
for (;begin < rbegin.base();begin++, rbegin++) {
swap(*begin, *rbegin);
}
return s;
}
};[/code]感覺上有bug

[[i] 本帖最後由 Susan﹏汪汪 於 2016-7-28 04:40 PM 編輯 [/i]]

darigold 2016-8-1 08:17 AM

[url=http://andrew-algorithm.blogspot.com/2016/05/leetcode-oj-reverse-vowels-of-string.html]LeetCode OJ - Reverse Vowels of a String[/url]

darigold 2016-8-7 10:47 PM

[url=http://andrew-algorithm.blogspot.com/2016/05/leetcode-oj-intersection-of-two-arrays.html]LeetCode OJ - Intersection of Two Arrays[/url]

Susan﹏汪汪 2016-8-8 01:16 PM

[code]return Array(Set(nums1).intersect(nums2))[/code]

darigold 2016-8-10 11:52 AM

[url=http://andrew-algorithm.blogspot.com/2016/06/leetcode-oj-data-stream-as-disjoint.html]LeetCode OJ - Data Stream as Disjoint Intervals[/url]

darigold 2016-8-21 05:28 AM

[url=http://andrew-algorithm.blogspot.com/2016/06/leetcode-oj-valid-perfect-square.html]LeetCode OJ - Valid Perfect Square[/url]

darigold 2016-8-24 09:58 AM

[url=http://andrew-algorithm.blogspot.com/2016/06/leetcode-oj-water-and-jug-problem.html]LeetCode OJ - Water and Jug Problem[/url]

darigold 2016-8-29 01:09 AM

[url=http://andrew-algorithm.blogspot.com/2016/07/leetcode-oj-lru-cache.html]LeetCode OJ - LRU Cache[/url]

darigold 2016-9-1 12:01 PM

Leetcode難唔難學？

darigold 2016-9-7 02:36 PM

[quote]原帖由 [i]哈伯馬斯[/i] 於 2016-9-7 11:52 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=447639854&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
Leetcode難唔難學？
[/quote]

Leetcode 係一個網站，佢唔係一種編程技術，所以你冇得「學 Leetcode」

darigold 2016-9-14 07:08 AM

[url=http://andrew-algorithm.blogspot.com/2016/07/leetcode-oj-russian-doll-envelopes.html]LeetCode OJ - Russian Doll Envelopes[/url]

darigold 2016-9-18 10:42 PM

[url=http://andrew-algorithm.blogspot.com/2016/07/leetcode-oj-largest-divisible-subset.html]LeetCode OJ - Largest Divisible Subset[/url]

darigold 2016-9-23 10:35 PM

[url=http://andrew-algorithm.blogspot.com/2016/07/leetcode-oj-wiggle-subsequence.html]LeetCode OJ - Wiggle Subsequence[/url]

darigold 2016-9-27 11:01 PM

[url=http://andrew-algorithm.blogspot.com/2016/09/leetcode-oj-guess-number-higher-or-lower.html]LeetCode OJ - Guess Number Higher or Lower[/url]

Susan﹏汪汪 2016-9-27 11:19 PM

[quote]原帖由 [i]darigold[/i] 於 2016-9-27 11:01 PM 發表 [url=http://www.discuss.com.hk/redirect.php?goto=findpost&pid=448773557&ptid=24497948][img]http://www.discuss.com.hk/images/common/back.gif[/img][/url]
LeetCode OJ - Guess Number Higher or Lower [/quote]

darigold 2016-9-30 10:02 PM

[url=http://andrew-algorithm.blogspot.com/2016/09/leetcode-oj-longest-absolute-file-path.html]LeetCode OJ - Longest Absolute File Path[/url]

ken2016man 2016-9-30 11:57 PM

darigold 2016-10-2 06:29 AM

[quote]原帖由 [i]ken2016man[/i] 於 2016-9-30 11:57 PM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=448944523&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]

[/quote]

:smile_o12:

darigold 2016-10-9 11:24 AM

[url=http://andrew-algorithm.blogspot.com/2016/09/leetcode-oj-first-unique-character-in.html]LeetCode OJ - First Unique Character in a String[/url]

darigold 2016-10-14 11:56 PM

[url=http://andrew-algorithm.blogspot.com/2016/09/leetcode-oj-lexicographical-numbers.html]LeetCode OJ - Lexicographical Numbers[/url]

darigold 2016-10-18 11:07 PM

[url=http://andrew-algorithm.blogspot.com/2016/09/leetcode-oj-find-difference.html]LeetCode OJ - Find the Difference[/url]

AC-Fans 2016-10-21 12:08 PM

submit左都唔可以睇人地D答案?

darigold 2016-10-21 01:44 PM

[quote]原帖由 [i]AC-Fans[/i] 於 2016-10-21 12:08 PM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=450141184&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
submit左都唔可以睇人地D答案?
[/quote]

GitHub 一 search 一大堆。

darigold 2016-10-26 01:26 PM

[url=http://andrew-algorithm.blogspot.com/2016/09/leetcode-oj-elimination-game.html]LeetCode OJ - Elimination Game[/url]

darigold 2016-10-30 12:05 AM

[url=http://andrew-algorithm.blogspot.com/2016/09/leetcode-oj-perfect-rectangle-i.html]LeetCode OJ - Perfect Rectangle (I)[/url]

darigold 2016-11-4 10:45 PM

[url=http://andrew-algorithm.blogspot.com/2016/09/leetcode-oj-mini-parser.html]LeetCode OJ - Mini Parser[/url]