Skip to content

Avisa-GA/Algorithm-Challenges-for-String

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

Algorithm-Challenges-for-String

Input : "2 + 5 = x"
And Output must be less than 10
Output : "7"

function missingDigit(str) {
   for(let i = 0; i<10; i++) {
    const newStr = str.replace(/x/, i.toString()).replace(/=/, '===');
    if (eval(newStr)) {
      return i;
    }
  }
  return 'failed';
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published