Skip to content

Instantly share code, notes, and snippets.

@4skinSkywalker
Created February 23, 2019 19:46
Show Gist options
  • Save 4skinSkywalker/201a105a7bea560d428481892fd13880 to your computer and use it in GitHub Desktop.
Save 4skinSkywalker/201a105a7bea560d428481892fd13880 to your computer and use it in GitHub Desktop.
The second hardest challenge listed in the “easy” section of Coderbyte.
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