Created
June 14, 2020 02:02
-
-
Save coderinblack08/e863f8d04fb3d81d6b85f31d9d45c091 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Problem Statement: 2D Peak Finder Algorithm | |
// Key concept: Divide and Conquer Strategy | |
// MIT Link: https://courses.csail.mit.edu/6.006/spring11/lectures/lec02.pdf | |
const matrix = [ | |
[10, 8, 10, 10], | |
[14, 13, 12, 11], | |
[15, 9, 11, 21], | |
[16, 17, 19, 20] | |
], | |
list = []; | |
// Find Max in each row | |
matrix.forEach(i => list.push(Math.max(...i))); | |
// Find Global Maximum | |
console.log(Math.max(...list)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment