Company: Visa_30may
Difficulty: easy
First Day to Reach Target Visits A website records how many people visited it on each of n consecutive days. The counts are given as an array visits , where visits[0] is the number of visitors on the first day, visits[1] the number on the second day, and so on. Find the first day on which the running total of visitors, counted from day one, reaches a given target . Report the index i of that day, using zero-based indices — that is, the smallest i for which visits[0] + visits[1] + ... + visits[i] >= target If the total over all n days never reaches target , report -1 . Input Format The first line contains a single integer n — the number of days. The second line contains n space-separated integers visits[0], visits[1], ..., visits[n-1] — the visitor count for each day. The third line contains a single integer target . Output Format Print a single integer — the zero-based index of the first day whose running total reaches target , or -1 if no day does. Constraints 1 <= n <= 10^5