[This content has been removed]

[This content has been removed]

If you ask me to solve this problem my logic will be very different and so I’m bit confused. Is it me having incorrect way of problem solving, or is it you trying to confuse me? :slight_smile:

[This content has been removed]

For each number and it’s index in array find all same numbers and their indexes, slice array between indexes and check if this slice equals to itself reversed:

const random = () => Math.ceil(Math.random() * 9));
const array = [...Array(100)].map(random);
const palindromes = [];

for (let i = 0; i < array.length - 1; i++) {
  for (let j = array.length - 1; j > i; j--) {
    if (array[i] === array[j]) {
      const slice = array.slice(i, j + 1);
      slice.join('') === slice.reverse().join('') && palindromes.push(slice.join(''));
    }
  }
}

console.log(array, palindromes);

[This content has been removed]