Back to problems

Solve Four Coding Assessment Tasks

Algorithm · Capital One · Hard

Solve the four independent programming problems described below. Task 1: Cumulative Visit Threshold You are given an array visits, where visits[i] is the number of site visits recorded on day i, and an integer target. Find the smallest 0-based day index d such that the running total satisfies $$\sum_{j=0}^{d} visits[j] \ge target$$ If the running total never reaches target, return -1. Example 1: Explanation: The running totals are 1, 5, and 7, so the target is first reached…

Checking your access…