Click here to Skip to main content
15,893,722 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
Bassam Abdul-Baki17-Sep-15 7:44
professionalBassam Abdul-Baki17-Sep-15 7:44 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
TedFalasco18-Sep-15 3:55
TedFalasco18-Sep-15 3:55 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
Bassam Abdul-Baki18-Sep-15 3:59
professionalBassam Abdul-Baki18-Sep-15 3:59 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
harold aptroot17-Sep-15 7:24
harold aptroot17-Sep-15 7:24 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
Bassam Abdul-Baki17-Sep-15 7:28
professionalBassam Abdul-Baki17-Sep-15 7:28 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
harold aptroot17-Sep-15 7:30
harold aptroot17-Sep-15 7:30 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
VuduDog18-Sep-15 2:49
VuduDog18-Sep-15 2:49 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
scott mankowitz18-Sep-15 9:41
scott mankowitz18-Sep-15 9:41 
Shouldn't it be 16? If there are 8 distinct groups of 3-4 numbers that sum to 14, one path will start with the first move going up and the next will start with the first move going right.

Incidentally, here is my code:

C#
function combine(a, min) {
    var fn = function(n, src, got, all) {
        if (n == 0) {
            if (got.length > 0) {
                all[all.length] = got;
            }
            return;
        }
        for (var j = 0; j < src.length; j++) {
            fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
        }
        return;
    }
    var all = [];
    for (var i = min; i < a.length; i++) {
        fn(i, a, [], all);
    }
    all.push(a);
    return all;
}

function arr_sum(arr) {
    var n = 0;
    for (var i = 0; i < arr.length; i++) {
        n += arr[i];
    }
    return n;
}
k=[1,2,3,4,5,6,7];
combine(k, 1).filter(function(v, i) {
    return 14 == arr_sum(v)
})

GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
Bassam Abdul-Baki18-Sep-15 9:47
professionalBassam Abdul-Baki18-Sep-15 9:47 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
scott mankowitz18-Sep-15 12:56
scott mankowitz18-Sep-15 12:56 
GeneralRe: Are You Smarter Than A Sixth Grader (Taking Seventh Grade Math)? Pin
Bassam Abdul-Baki18-Sep-15 13:04
professionalBassam Abdul-Baki18-Sep-15 13:04 
GeneralAn idea to make their life easier Pin
5imone17-Sep-15 6:29
professional5imone17-Sep-15 6:29 
GeneralRe: An idea to make their life easier Pin
Amarnath S17-Sep-15 6:48
professionalAmarnath S17-Sep-15 6:48 
GeneralRe: An idea to make their life easier Pin
Matthew Dennis17-Sep-15 7:00
sysadminMatthew Dennis17-Sep-15 7:00 
GeneralRe: An idea to make their life easier Pin
PompeyThree17-Sep-15 13:18
PompeyThree17-Sep-15 13:18 
GeneralRe: An idea to make their life easier Pin
Mycroft Holmes17-Sep-15 14:23
professionalMycroft Holmes17-Sep-15 14:23 
GeneralSSPOD Pin
Duncan Edwards Jones17-Sep-15 6:05
professionalDuncan Edwards Jones17-Sep-15 6:05 
GeneralRe: SSPOD Pin
R. Giskard Reventlov17-Sep-15 6:11
R. Giskard Reventlov17-Sep-15 6:11 
GeneralRe: SSPOD Pin
Mike Hankey17-Sep-15 8:16
mveMike Hankey17-Sep-15 8:16 
RantAn old scam... Pin
R. Giskard Reventlov17-Sep-15 5:26
R. Giskard Reventlov17-Sep-15 5:26 
GeneralRe: An old scam... Pin
OriginalGriff17-Sep-15 5:30
mveOriginalGriff17-Sep-15 5:30 
GeneralRe: An old scam... Pin
R. Giskard Reventlov17-Sep-15 5:31
R. Giskard Reventlov17-Sep-15 5:31 
GeneralRe: An old scam... Pin
Kevin Marois17-Sep-15 5:39
professionalKevin Marois17-Sep-15 5:39 
GeneralRe: An old scam... Pin
dandy7217-Sep-15 6:42
dandy7217-Sep-15 6:42 
GeneralRe: An old scam... Pin
Richard MacCutchan17-Sep-15 5:56
mveRichard MacCutchan17-Sep-15 5:56 

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.