You are viewing a single comment's thread. Return to all comments →
Here's my solution in JS:
let count = 0; for(let i = 0; i < arr[0].length; i++){ let ch = arr[0].charAt(i); let hasGem = true; if(arr[0].indexOf(ch) === i){ for(let j = 1; j < arr.length; j++){ if(arr[j].indexOf(ch) === -1){ hasGem = false; break; } } if(hasGem) { count++; } } } return count;
Seems like cookies are disabled on this browser, please enable them to open this website
Gemstones
You are viewing a single comment's thread. Return to all comments →
Here's my solution in JS: