FastPrepFastPrep
Problem Brief

Count Four-Digit Codes with Sum S

INTERNOA

Consider all codes made of four digits (0-9). How many of them have a sum of digits equal to S? For example, for S = 4, there are 35 such codes in total. Some of them are 0022, 1003, 1111, 2020, 4000.

Write a function in the editor ๐Ÿ‘‰

that, given an integer S, returns the number of four-digit codes whose sum of digits is equal to S.

Assume that:

  • S is an integer within the range [0..36]

In your solution, focus on correctness. The performance of your solution will not be the focus of this assessment.

โŠน เฃช ๏น๐“Š๏น๐“‚ƒ ๐“ˆ’๐“ธA heartfelt thanks to Aura Man!~~๐“‚๏นโŠน เฃช

1Example 1

Input
S = 35
Output
4
Explanation
The posible code are 9998, 9989, 9899, 8999, The function should return 4 :)

2Example 2

Input
S = 4
Output
35
Explanation
Google says there is no explanation ๐Ÿ˜ฑ

3Example 3

Input
S = 2
Output
10
Explanation
Google expects us to know the explanation by this point ๐Ÿ‘ป

Constraints

Limits and guarantees your solution can rely on.

S is an integer within the range [0..36].
public int googleCountWithSumS(int S) {
  // write your code here
}
Input

S

35

Output

4

Sign in to submit your solution.