본문 바로가기
알고리즘/Codewars

[Codewars] Beginner Series #1 School Paperwork (8 kyu) / JavaScript

by fluss 2023. 1. 17.

https://www.codewars.com/kata/55f9b48403f6b87a7c0000bd

 

Codewars - Achieve mastery through coding practice and developer mentorship

A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!

www.codewars.com

 

DESCRIPTION:

Your classmates asked you to copy some paperwork for them. You know that there are 'n' classmates and the paperwork has 'm' pages.

 

Your task is to calculate how many blank pages do you need. If n < 0 or m < 0 return 0.

 

Example:

n= 5, m=5: 25
n=-5, m=5:  0

Waiting for translations and Feedback! Thanks!

 

코드

function paperwork(n, m) {
  if(n < 0 || m < 0) return 0;
  return n * m;
}

댓글