Lead Developer, business owner, US Army veteran. I build things for the web. My website is a bunch of HTML pages that didn't need a framework. Yours can be too!
Changed, only cause when I submitted on coderbyte, the test cases showed that "-B" cases were possible in the first string (IE: comparing vs an edited string as opposed to a base-string, so... egg on my face haha)
(And I edited again... because code review matters, and there's code to be removed...)
Here's the modified solution:
function compare(str) {
return str.split(',')
.reduce((agg, current) => {
return current === '-B'
? agg.substring(0, agg.length - 1)
: agg + current;
}, '');
}
function EquivalentKeypresses(strArr) {
// code goes here
return compare(strArr[0]).localeCompare(compare(strArr[1]),'en',{ignorePunctuation: true}) === 0;
}
// keep this function call here
console.log(EquivalentKeypresses(readline()));
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Changed, only cause when I submitted on coderbyte, the test cases showed that "-B" cases were possible in the first string (IE: comparing vs an edited string as opposed to a base-string, so... egg on my face haha)
(And I edited again... because code review matters, and there's code to be removed...)
Here's the modified solution: