Javascript enters two integers n and m, and takes the sum of n between 1m and m

enter two integers n and m, take a few numbers at random from the sequence 1p2 and m, and make their sum equal to m. All possible combinations are required to be listed.

fn (5pm 7) = >

[1, br 2, 4]
[2, 5, 5]
[3, 4, 4]

Sep.22,2021

function f(max, min, m, t, mid, result) {
    if (t > m) {
        return
    }
    if (t === m) {
        result.push(mid)
        return
    }
    for (let i = min; i <= max; iPP) {
        f(max, i + 1, m, t + i, [...mid, i], result)
    }
}

var result = []
var m = 5
var n = 10
f(Math.min(m, n), 1, m, 0, [], result)

console.log(result)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3ce45-446ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3ce45-446ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?