Async Max of Two
JavaScript
Easy
6 views
Problem Description
Given two numbers a and b, find the bigger number using async/await and print it.
Input Format
One line: a b.
Output Format
One integer.
Constraints
a and b are integers.
Official Solution
const fs=require('fs');const p=fs.readFileSync(0,'utf8').trim().split(/\\s+/);if(!p[0])process.exit(0);let a=BigInt(p[0]),b=BigInt(p[1]);const get=async v=>{await Promise.resolve();return v;};(async()=>{const A=await get(a);const B=await get(b);process.stdout.write((A>B?A:B).toString());})();
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!