Valor onipresente

Um valor é onipresente se estiver presente em cada subarray do array principal.

Para ilustrar:

new int[][] { new int[] { 3, 4 }, new int[] { 8, 3, 2 }, new int[] { 3 }, new int[] { 9, 3 }, new int[] { 5, 3 }, new int[] { 4, 3 } }
// 3 está presente em cada subarray, portanto é onipresente.

Crie um método que determine se um valor de entrada é onipresente em um determinado array.

Exemplos

Program.IsOmnipresent(new int[][] { new int[] { 1, 1 }, new int[] { 1, 3 }, new int[] { 5, 1 }, new int[] { 6, 1 } }, 1) ➞ true

Program.IsOmnipresent(new int[][] { new int[] { 1, 1 }, new int[] { 1, 3 }, new int[] { 5, 1 }, new int[] { 6, 1 } }, 6) ➞ false

Program.IsOmnipresent(new int[][] { new int[] { 5 }, new int[] { 5 }, new int[] { 5 }, new int[] { 6, 5 } }, 5) ➞ true

Program.IsOmnipresent(new int[][] { new int[] { 5 }, new int[] { 5 }, new int[] { 5 }, new int[] { 6, 5 } }, 6) ➞ false

Notas

  • Os subarrays podem ter qualquer tamanho.
  • O array externo contém pelo menos um array interno que não seja null.
  • Um array interno vazio não pode conter o valor, portanto faz com que o resultado seja false.