You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Write a JavaScript program to find all the possible options to replace the hash in a string (Consists of digits and one hash (#)) with a digit to produce an integer divisible by 3.
// For a string "2*0", the output should be : ["210", "240", "270"]
const prompt = require("prompt-sync")();
function isDivisibleBy3(str) {
var digitSum = 0,
left = "0".charCodeAt(),
right = "9".charCodeAt(),
result = [],
data = str.split(""),
pos = -1;
for (let i = 0; i < str.length; i++) {
if (left <= data[i].charCodeAt() && data[i].charCodeAt() <= right) {