diff --git a/GeeksforGeeks/GeeksAndBalls/question.md b/GeeksforGeeks/GeeksAndBalls/question.md new file mode 100644 index 0000000..f0c50e1 --- /dev/null +++ b/GeeksforGeeks/GeeksAndBalls/question.md @@ -0,0 +1,21 @@ +Geek loves to play with balls. He decided to go to market and buy few more balls for himself. Seeing Geek's love for balls, the kind shopkeeper offers him twice the number of balls what Geek already have. He will only offer this if the number of balls Geek already have is not a multiple of 2. +Given an integer n representing the number of balls geek already have. Find out how many balls will be offered to him by the shopkeeper. + +Example 1: +Input: N = 10 +Output: 0 +Explanation: As 10 is a multiple of 2 so Geek won't be offered any balls. + +Example 2: +Input: N = 7 +Output: 14 +Explanation: As 7 is not a mutliple of 2 so the shopkeeper would offer him the ball equal to twice of 7 i.e. 14. + +Your Task: + +Complete the function countBalls() which takes an integer n as input and returns an integer representing the total number of balls Geek will be offered. + +Expected Time Complexity: 0(1) +Expected Space Complexity: 0(1) +Constraints: +1<