Curry Add
JavaScript
Medium
6 views
Problem Description
Create a function add(a)(b)(c) that returns a+b+c. For input a b c, print the result using currying.
Input Format
One line: a b c.
Output Format
One integer.
Constraints
Values are integers in -1e9..1e9.
Official Solution
const fs=require('fs');const [a,b,c]=fs.readFileSync(0,'utf8').trim().split(/\\s+/).map(Number);const add=a=>b=>c=>a+b+c;process.stdout.write(String(add(a)(b)(c)));
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!