Click here to Skip to main content
15,905,005 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Bin Packing Pin
Cenator22-Aug-15 0:04
Cenator22-Aug-15 0:04 
AnswerRe: Bin Packing Pin
Patrice T22-Aug-15 3:46
mvePatrice T22-Aug-15 3:46 
QuestionStrict alternation Pin
Bowri18-Aug-15 4:11
Bowri18-Aug-15 4:11 
AnswerRe: Strict alternation Pin
Simon_Whale18-Aug-15 5:12
Simon_Whale18-Aug-15 5:12 
GeneralRe: Strict alternation Pin
Bowri18-Aug-15 7:14
Bowri18-Aug-15 7:14 
GeneralRe: Strict alternation Pin
Richard MacCutchan18-Aug-15 7:40
mveRichard MacCutchan18-Aug-15 7:40 
GeneralRe: Strict alternation Pin
Bowri18-Aug-15 18:11
Bowri18-Aug-15 18:11 
AnswerRe: Strict alternation Pin
Patrice T21-Aug-15 12:16
mvePatrice T21-Aug-15 12:16 
Questionl-Exclusion Pin
Bowri18-Aug-15 4:09
Bowri18-Aug-15 4:09 
SuggestionRe: l-Exclusion Pin
Richard MacCutchan18-Aug-15 6:39
mveRichard MacCutchan18-Aug-15 6:39 
GeneralRe: l-Exclusion Pin
Bowri18-Aug-15 7:17
Bowri18-Aug-15 7:17 
GeneralRe: l-Exclusion Pin
Richard MacCutchan18-Aug-15 7:38
mveRichard MacCutchan18-Aug-15 7:38 
GeneralRe: l-Exclusion Pin
Bowri18-Aug-15 18:10
Bowri18-Aug-15 18:10 
GeneralRe: l-Exclusion Pin
Richard MacCutchan18-Aug-15 21:49
mveRichard MacCutchan18-Aug-15 21:49 
QuestionCounting Semaphore Using Test&Set() Pin
Bowri18-Aug-15 4:08
Bowri18-Aug-15 4:08 
QuestionLENGTH of the maximum contiguous sum Pin
Member 1187537030-Jul-15 11:56
Member 1187537030-Jul-15 11:56 
GeneralRe: LENGTH of the maximum contiguous sum Pin
PIEBALDconsult30-Jul-15 12:06
mvePIEBALDconsult30-Jul-15 12:06 
GeneralRe: LENGTH of the maximum contiguous sum Pin
Member 1187537030-Jul-15 12:25
Member 1187537030-Jul-15 12:25 
GeneralRe: LENGTH of the maximum contiguous sum Pin
PIEBALDconsult30-Jul-15 12:33
mvePIEBALDconsult30-Jul-15 12:33 
GeneralRe: LENGTH of the maximum contiguous sum Pin
Member 1187537030-Jul-15 12:40
Member 1187537030-Jul-15 12:40 
I tried the below code, but just get the max num, to solve the leetcode question. This is the interview question I just faced today.
Java
public int getMaxLen(int[] nums) {
   int sum=nums[0];
   int max=Integer.MIN_VALUE;
   int result = 0;
   int cnt = 0;
   for(int i=1;i<nums.length;i++){
       sum=Math.max(sum+nums[i],nums[i]);
       max= Math.max(max, sum);
       //need work
       //...
   }
   // only get the max num, need to figure out the length
   // max is the maximum sum
   return result;
}

GeneralRe: LENGTH of the maximum contiguous sum Pin
PIEBALDconsult30-Jul-15 13:14
mvePIEBALDconsult30-Jul-15 13:14 
GeneralRe: LENGTH of the maximum contiguous sum Pin
PIEBALDconsult30-Jul-15 18:21
mvePIEBALDconsult30-Jul-15 18:21 
GeneralRe: LENGTH of the maximum contiguous sum Pin
PIEBALDconsult31-Jul-15 5:34
mvePIEBALDconsult31-Jul-15 5:34 
Questiona special type of bin packing problem Pin
Cenator19-Jul-15 20:39
Cenator19-Jul-15 20:39 
AnswerRe: a special type of bin packing problem Pin
Richard MacCutchan19-Jul-15 21:47
mveRichard MacCutchan19-Jul-15 21:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.