You are viewing a single comment's thread. Return to all comments →
Here's my JS approach:
let space = false; let beside = true; for(let i = 0; i < b.length; i++){ if(b.charAt(i) === `_`){ space = true; } else if(b.indexOf(b.charAt(i)) === i){ let count = 0; let j = i + 1; let k = i; while(j !== 0){ j = b.indexOf(b.charAt(i), j); if(j-k > 1) { beside = false; } k = j; count++; j++; } if(count === 1){ return `NO`; } } } return (space || beside) ? `YES` : `NO`;
Seems like cookies are disabled on this browser, please enable them to open this website
Happy Ladybugs
You are viewing a single comment's thread. Return to all comments →
Here's my JS approach: