Programmer's written examination of Bilibili 2021 back-end development programming questions collection (5)

1. Given 4 numbers from 1 to 10, by adding, subtracting, multiplying and dividing , the number obtained is 24 even if you win.
Example 1:
Input:
[7,2,1,10]
Output:
true
Description: 7* 2+1* 10

2. Given a string containing only parentheses, determine whether the string is valid. Among them, bracket types include:'(',')','{','}','[',']'. A valid string must satisfy: 1) The left parenthesis must be closed with the same type of right parenthesis; 2) The left parenthesis must be closed in the correct order, note that an empty string can be considered a valid string
Example 1:
Input:
"{ [] }”
output:
true

Example 2:
Input:
"([)]"
Output:
false

Example 3:
Input:
"([]"
Output:
false

3. There are four kinds of coins with a face value of 1, 4, 16 and 64 yuan, and a banknote with a face value of 1024 yuan. Now Xiao Y uses 1024 yuan banknotes to buy a product with a value of N (0<N<=1024). How many coins will he receive at least
Example 1:
Input:
200
Output:
17
Description: 12 64 yuan coins , 3 16 yuan coins, 2 4 yuan coins

Guess you like

Origin blog.csdn.net/qq_34124009/article/details/108037177