查看完整版本 : LeetCode

darigold 2015-8-15 12:13 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-symmetric-tree.html]LeetCode OJ - Symmetric Tree[/url]

[[i] 本帖最後由 darigold 於 2015-8-15 12:15 AM 編輯 [/i]]

darigold 2015-8-15 05:18 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-generate-parentheses.html]LeetCode OJ - Generate Parentheses[/url]

darigold 2015-8-16 04:59 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-swap-nodes-in-pairs.html]LeetCode OJ - Swap Nodes in Pairs[/url]

darigold 2015-8-16 05:00 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-add-binary.html]LeetCode OJ - Add Binary[/url]

darigold 2015-8-16 07:03 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-binary-tree-paths.html]LeetCode OJ - Binary Tree Paths[/url]

darigold 2015-8-16 08:11 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-binary-tree-level-order.html]LeetCode OJ - Binary Tree Level Order Traversal II[/url]

darigold 2015-8-17 07:00 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-add-digits.html]LeetCode OJ - Add Digits[/url]

darigold 2015-8-19 10:02 PM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-ugly-number.html]LeetCode OJ - Ugly Number[/url]

[[i] 本帖最後由 darigold 於 2015-8-19 10:05 PM 編輯 [/i]]

darigold 2015-8-21 01:23 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-ugly-number-ii.html]LeetCode OJ - Ugly Number II[/url]

darigold 2015-8-21 01:29 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-single-number-iii.html]LeetCode OJ - Single Number III[/url]

這題有意思,建議先自己想想。

darigold 2015-8-22 01:45 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-valid-palindrome.html]LeetCode OJ - Valid Palindrome[/url]

darigold 2015-8-23 03:21 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-implement-strstr.html]LeetCode OJ - Implement strStr()[/url]

呢條我試左新野,z-box algorithm, as described in [url=http://www.amazon.com/Algorithms-Strings-Trees-Sequences-Computational/dp/0521585198]Algorithms on Strings, Trees and Sequences.[/url]

[[i] 本帖最後由 darigold 於 2015-8-23 03:24 AM 編輯 [/i]]

darigold 2015-8-23 04:06 AM

完成100題。

darigold 2015-8-24 02:43 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-valid-sudoku.html]LeetCode OJ - Valid Sudoku[/url]

darigold 2015-8-24 05:37 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-compare-version-numbers.html]LeetCode OJ - Compare Version Numbers[/url]

有諗辦法 2015-8-24 06:26 AM

[quote]原帖由 [i]darigold[/i] 於 2015-8-24 02:43 AM 發表 [url=http://www.discuss.com.hk/redirect.php?goto=findpost&pid=424214375&ptid=24497948][img]http://www.discuss.com.hk/images/common/back.gif[/img][/url]LeetCode OJ - Valid Sudoku [/quote]

Sudoku 我有興趣想知一開頭點產生,請問師兄有冇 link 可以參考?我搵過有好多 online generator , 但搵唔到 generator 個 code :smile_35:



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

darigold 2015-8-24 06:33 AM

[quote]原帖由 [i]有諗辦法[/i] 於 2015-8-24 06:26 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=424217413&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
Sudoku 我有興趣想知一開頭點產生,請問師兄有冇 link 可以參考?我搵過有好多 online generator , 但搵唔到 generator 個 code :smile_35:
[/quote]
我寫過solver,用constraint programming 加 search,但係唔識generate。
有冇其它師兄識generate?

darigold 2015-8-25 12:25 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-missing-number.html]LeetCode OJ - Missing Number[/url]

煙民母親生賤種 2015-8-25 04:06 AM

[quote]原帖由 [i]darigold[/i] 於 2015-8-24 06:33 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=424217468&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]

我寫過solver,用constraint programming 加 search,但係唔識generate。
有冇其它師兄識generate? [/quote] 係咪即係咁?

for (int i; i < col.length; i++)
{
  for (int y; y<row.length; y++)
  {
      checkViable();
  }
}

book checkViable()
{
  while(int i < x*y)
  {
     if (false)
      genAgain();
       else
      return true;
  }
}

Susan﹏汪汪 2015-8-25 07:33 AM

[quote]原帖由 [i]darigold[/i] 於 2015-8-24 06:33 AM 發表 [url=http://www.discuss.com.hk/redirect.php?goto=findpost&pid=424217468&ptid=24497948][img]http://www.discuss.com.hk/images/common/back.gif[/img][/url]

我寫過solver,用constraint programming 加 search,但係唔識generate。
有冇其它師兄識generate? [/quote]
之前睇過某個台灣網站
歸納左Sudoku只有幾種 algorithms solve problems
solve唔到嘅都會搵到超過一個或者冇答案

所以gen sudoku有兩做法
第一種係用模板、然後行與行、列與列做洗牌
第二種係用頭先講嘅algorithm 做出來



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

有諗辦法 2015-8-25 08:03 AM

只可以有一個答案 :smile_27:



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

darigold 2015-8-28 12:01 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-divide-two-integers.html]LeetCode OJ - Divide Two Integers[/url]

Do you know why division may lead to overflow - read the link to know more.

[[i] 本帖最後由 darigold 於 2015-8-28 12:04 AM 編輯 [/i]]

煙民母親生賤種 2015-8-28 12:22 AM

[quote]原帖由 [i]darigold[/i] 於 2015-8-28 12:01 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=424501778&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
LeetCode OJ - Divide Two Integers

Do you know why division may lead to overflow - read the link to know more. [/quote]The link responds : :fst_002:


[attach]4717296[/attach]

darigold 2015-8-28 04:42 AM

[quote]原帖由 [i]煙民母親生賤種[/i] 於 2015-8-28 12:22 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=424503419&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
The link responds ...
[/quote]你個咩browser?

On Win 10

Edge/IE/Chrome/FireFox 都冇問題?

煙民母親生賤種 2015-8-28 11:31 PM

[quote]原帖由 [i]darigold[/i] 於 2015-8-28 04:42 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=424511329&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
你個咩browser?

On Win 10

Edge/IE/Chrome/FireFox 都冇問題? [/quote]今日又去到了, 但係好 X 多 popup window 彈 D Ads 出黎! :fst_016:

darigold 2015-8-29 07:39 AM

[quote]原帖由 [i]煙民母親生賤種[/i] 於 2015-8-28 11:31 PM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=424568701&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
今日又去到了, 但係好 X 多 popup window 彈 D Ads 出黎! :fst_016:[/quote]

Ignore the ads... now you know how division can lead to overflow?

darigold 2015-9-1 12:21 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-sqrtx.html]LeetCode OJ - Sqrt(x)[/url]

Let's do something numerical - start with Newton's method.

Susan﹏汪汪 2015-9-1 07:25 AM

[quote]原帖由 [i]darigold[/i] 於 2015-9-1 12:21 AM 發表 [url=http://www.discuss.com.hk/redirect.php?goto=findpost&pid=424778730&ptid=24497948][img]http://www.discuss.com.hk/images/common/back.gif[/img][/url]
LeetCode OJ - Sqrt(x)

Let's do something numerical - start with Newton's method. [/quote]
[url]https://en.wikipedia.org/wiki/Fast_inverse_square_root[/url]



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

有諗辦法 2015-9-1 07:34 AM

integer divide 同 sqrt , 其實都好似以前用 asm 寫嘅一樣 … 應該冇難度  :smile_34:



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

darigold 2015-9-2 12:18 PM

Getting busy these days ... will resume coding later.

It would be interesting to see integer division code in assembly. Can you share what you did?

There is a big integer multiplication problem on LeetCode, want to try?
頁: 1 2 [3] 4 5 6 7 8 9 10 11 12
查看完整版本: LeetCode