HSOLVE - Hard to solve
You will be given an array of N integers and X integer. Write a recursive function to find if X is in the array or not.
Input
Input starts with an integer T (T ≤ 100), the number of test cases.
Each of the next 2*T lines will start with an integer N (1 <= N <= 100), number of integers followed by N space separated. Each of these N integers will be between -1000 and 1000 (inclusive).Then next line will have X (-1000 <= X <= 1000) representing the number you want to search for.
Output
For each test case, output one line in the format “Case t: a”, where t is the case number and a “YES” if you found X or “NO” if didn’t found. (quotes for clarity).
Example
Input:
2
5 5 13 -11 19 93
-19
3 15 65 -18
-18 Output:
Case 1: NO
Case 2: YES
Added by: | Mohamed Ali |
Date: | 2013-04-27 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |