Question: 1 A teacher has been given a task to select a group of students for a quiz. An array of integers represents a number of students standing in a line and the value at any index represents the intelligence of that student. The teacher can only select a student or a group of students if the total intelligence of students standing consecutively is equal to an integer K. Find how many choices the teacher has to select a group. Example 1 Input: intelligence = [1,1,1), k= 2 Output: 2 Example 2 Input intelligence = [1,2,3], k = 3 Output: 2 Explanation: The teacher can select either the group of students at 0 and 1 index or student at index 2 alone. Time Complexity - O(N) Space Complexity-O(N)

Answers 1

Explanation:

A teacher has been given a task to select a group of students for a quiz. An array of integers represents a number of students standing in a line and the value at any index represents the intelligence of that student. The teacher can only select a student or a group of students if the total intelligence of students standing consecutively is equal to an integer K. Find how many choices the teacher has to select a group.

Example 1

Input: intelligence = [1,1,1), k= 2

Output: 2

Example 2

Input intelligence = [1,2,3], k = 3

Output: 2

Explanation: The teacher can select either the group of students at 0 and 1 index or student at index 2 alone.

Time Complexity - O(N)

Space Complexity-O(N)

If you know the answer add it here!

Can't find the answer?

Log in with Google

or

Forgot your password?

I don't have an account, and I want to Register

Choose a language and a region
How much to ban the user?
1 hour 1 day 100 years