repeated_matrix_values

package
v0.0.0-...-86b9fec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 0 Imported by: 0

README

Repeated Matrix Values

Write a function that takes in a non-empty two-dimensional integer array (a matrix) of potentially unequal height and width and returns a list of the elements that appear at least once in each row and each column of the matrix.

Sample Input

matrix = [
  [1, 3, 7, 4, 5],
  [2, 5, 9, 3, 3],
  [1, 8, 5, 3, 5],
  [5, 0, 3, 5, 6],
  [3, 8, 3, 5, 6],
  [1, 0, 3, 0, 5],
] 

Sample Output

[3, 5] // The numbers could be ordered differently.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RepeatedMatrixValues

func RepeatedMatrixValues(matrix [][]int) []int

RepeatedMatrixValues O(n) time | O(min(w, h)) space - where n is the total number of elements in the matrix and w and h are the width and height of the matrix, respectively

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL