Js in the original array based on every 3 values to form a new array, the values inside can not be repeated, how to combine?

js forms a new array every 3 values based on the original array, and the values in it cannot be repeated

.

primitive array

var result = [];
$.each(arr,function(i){
            var newArr = [];
            newArr.push(arr[i]);
            for(var a=i; a<arrLength; aPP){
                    newArr.push(arr[a]);
                    if(arr[a+1]){
                        newArr.push(arr[a+1]);
                    }
                if(newArr.length == 3){
                    result.push(newArr);
                }
            }
        });

        console.log(result);
Apr.30,2021

Classical combinatorial problem. Sort first, then dfs + backtracking and finally judge the length.

  

Combinatorial problem. Write or find a combination library. For loop is not universal

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-1b40c5d-2c532.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-1b40c5d-2c532.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?