討論串[討論] 面試遇到的考題
共 27 篇文章

推噓1(1推 0噓 15→)留言16則,0人參與, 最新作者lichihwu (lichih)時間11年前 (2014/07/03 17:38), 11年前編輯資訊
0
0
1
內容預覽:
michael0728n正解啦. inp = [2 , -7 , 0, 1, 2 , 3 , 8 , -6 , 5, 0, 9, 2, 0, 1, 2 , 8, 8 , -6 , 5]. max_ = inp[0] * inp[1]. def f(inp):. global max_. v_ = 1
(還有286個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者manlike ( )時間11年前 (2014/07/03 17:29), 編輯資訊
0
0
1
內容預覽:
剛剛隨便寫的.... #include <stdio.h>. int maxSubListProduct(int* list, int n) {. int max = list[0];. int curMax = list[0];. int curMin = list[0];. int pMin;.
(還有509個字)

推噓4(4推 0噓 0→)留言4則,0人參與, 最新作者pika0923 (宜安)時間11年前 (2014/07/03 17:18), 11年前編輯資訊
0
0
1
內容預覽:
想了一個作法 開兩個陣列存 "含有這個位子及以左的最大值和最小值". 叫他amax和amin好了. 由於這題目一定是整數 在這裡絕對值要變大就要一路乘下去 不然就不乘(0的狀況). 所以 amax[x]會是 ar[x], ar[x]*amax[x-1], ar[x]*amin[x-1]三者之一. 同
(還有996個字)

推噓1(1推 0噓 2→)留言3則,0人參與, 最新作者TonyQ (自立而後立人)時間11年前 (2014/07/03 16:16), 11年前編輯資訊
0
0
1
內容預覽:
我參考 miachel 意見實作的版本,雖然我覺得我應該是寫複雜了。 XD. var input = [2 , -7 , 0 , 2 , 3 , 8 , -6 , 5];. var result = {sum:input[0],items:[input[0]]};. var stacks = [];
(還有2083個字)

推噓2(2推 0噓 11→)留言13則,0人參與, 最新作者developers (一心不亂)時間11年前 (2014/07/03 15:51), 11年前編輯資訊
0
0
1
內容預覽:
int MaxSubArrayProduct(int A[], int n). {. int curSubarrMax = 1;. int dpMax = INT_MIN;. for (int i = 0; i < n; ++i). {. curSubarrMax = std::max(curSub
(還有132個字)