Created
February 23, 2019 19:46
-
-
Save 4skinSkywalker/201a105a7bea560d428481892fd13880 to your computer and use it in GitHub Desktop.
The second hardest challenge listed in the “easy” section of Coderbyte.
This file contains 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
function vowelSquare(matrix) { | |
let vowels = { | |
a: 1, | |
e: 1, | |
i: 1, | |
o: 1, | |
u: 1 | |
} | |
let rows = matrix.length | |
let cols = matrix[0].length | |
for (let i = 0; i < rows - 1; i++) { | |
for (let j = 0; j < cols - 1; j++) { | |
if (matrix[i][j] in vowels | |
&& matrix[i][j+1] in vowels | |
&& matrix[i+1][j] in vowels | |
&& matrix[i+1][j+1] in vowels) { | |
return `${i}-${j}` | |
} | |
} | |
} | |
return 'not found' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment