看板
[ Soft_Job ]
討論串[討論] 面試遇到的考題
共 27 篇文章
內容預覽:
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個字)
內容預覽:
剛剛隨便寫的.... #include <stdio.h>. int maxSubListProduct(int* list, int n) {. int max = list[0];. int curMax = list[0];. int curMin = list[0];. int pMin;.
(還有509個字)
內容預覽:
想了一個作法 開兩個陣列存 "含有這個位子及以左的最大值和最小值". 叫他amax和amin好了. 由於這題目一定是整數 在這裡絕對值要變大就要一路乘下去 不然就不乘(0的狀況). 所以 amax[x]會是 ar[x], ar[x]*amax[x-1], ar[x]*amin[x-1]三者之一. 同
(還有996個字)
內容預覽:
我參考 miachel 意見實作的版本,雖然我覺得我應該是寫複雜了。 XD. var input = [2 , -7 , 0 , 2 , 3 , 8 , -6 , 5];. var result = {sum:input[0],items:[input[0]]};. var stacks = [];
(還有2083個字)
內容預覽:
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個字)