Number-ish Check
JavaScript
Easy
3 views
Problem Description
One string is given. If JavaScript Number(s) becomes a valid number (not NaN), print YES else print NO.
Input Format
One line string.
Constraints
String length up to 1e5.
Official Solution
const fs=require('fs');const s=fs.readFileSync(0,'utf8');const t=s.replace(/\
?\
$/,'');const n=Number(t);process.stdout.write(Number.isNaN(n)?'NO':'YES');
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!