Different sequenece of number from array of numbers

I want to have an array of numbers and I want to get the different sequences from the same array of numbers. E.g of an array is : [ [ 7, 3 ], [ 7, 5, 3, 2 ], [ 7, 5 ], [ 7 ] ] I want to have different and multiple sequences. I have been trying hard on this for 2 days now and couldn’t get it.

What’s your code so far? What did you try already? Giving some specific example (of how answer should look like) also would allow for easier helping.

solve(puzzleString) {
    const validate = this.validate(puzzleString)
    const puzzleArr = puzzleString.split("")
    console.log("for puzzleArr: ", puzzleArr)
    if(validate == "valid"){
      for(let i = 0; i < 81; i++){
        const {row, column} = this.getRowColumn(i)
        console.log("row derived is : " + row + " col : " + column + " for i " + i)
        if(column == 1){
          var matchArr = []
          var index = -1
          var tIndex = 0;
        }
        
        if(puzzleArr[i].match(/\./)){ 
          index++;
          matchArr[index] = []
          for(let j = 9; j > 0; j--){
          const checkValue = this.checkPlaceAndValue(puzzleString, row, column, j) 
          
          if(checkValue == true){
            tIndex++
            matchArr[index] = [...matchArr[index], j]    
          }
        } 
        } 
        if(column == 9){
          console.log("matchArr: ", matchArr)
        }
        }
      } else {
      return {error: validate};
      }
    return puzzleArr.join("")
    }

Its last step for sedoku solve function. I want to take each row and look for possible empty spaces and then by checking row column and region placement I look for possible numbers that can be inserted. Those numbers are stored in matchArr. The problem is, I want to iterate through and make sequences of number then insert full row in a grid and check. If any possible sequence passed then that sequence is edited into a grid.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.