Maximum Decrypted Score
Updated
Problem statement
You are given two arrays of equal length: scores and decryptionStatus. The value scores[i] is the sensitivity score of file i.
The value decryptionStatus[i] describes the current state of file i:
1means the file is already decrypted.0means the file is still encrypted.
You may perform the following operation at most once: choose a contiguous subarray containing at most k files and decrypt every file in that subarray.
Return the maximum possible sum of the scores of all decrypted files after the optional operation.
Function
maximumDecryptedScore(scores: int[], decryptionStatus: int[], k: int) → longExamples
Example 1
scores = [7,4,3,5]decryptionStatus = [1,0,0,0]k = 2return = 15The already decrypted first file contributes 7. Choosing indices [2,3] decrypts files with scores 3 and 5, producing 7 + 3 + 5 = 15, which is greater than the totals from the other length-two segments.
Constraints
1 <= scores.length <= 10^3decryptionStatus.length == scores.length0 <= scores[i] <= 10^9decryptionStatus[i]is either0or1.1 <= k <= scores.length
Source note: These screenshots are independent source sightings of the same Microsoft New Grad OA question.
More Microsoft Online Assessment questions
- Maximum Score with Prime JumpsOA · Seen Dec 2026
- Minimum Non-Adjacent Selection CapabilityOA · Seen Dec 2026
- Authentication SystemOA · Seen Nov 2026
- Maximum String OperationsOA · Seen Nov 2026
- Minimum Cost to Process Priority TasksOA · Seen Nov 2026
- Most Visited Sprint MarkerOA · Seen Nov 2026
- Maximum Escape Game ScoreOA · Seen Nov 2026
- Count Subarrays with a Perfect-Square ProductOA · Seen Nov 2026
- Maximum Interactive Team SizeOA · Seen Nov 2026
- Maximize Pipeline Throughput Under a Scaling BudgetOA · Seen Nov 2026
Similar questions at other companies
- API Rate Limit Violation DetectionTekion · OATekion interview questions
- Count Subarrays With Product Equal to KSalesforce · OASalesforce interview questions
- Garden Sprinkler PlacementAirbnb · OAAirbnb interview questions
- Sliding-Window Means with IEEE Special ValuesHeadlands Technologies · OAHeadlands Technologies interview questions
- Earn the Most 🐝Capital One · OACapital One interview questions
- Count Belt Sections With K Fruit Pairs (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
- Count Servers With No Requests in a Time WindowIBM · OAIBM interview questions
- Reschedule Meetings for Maximum Free TimeFivetran · OAFivetran interview questions
- Count Subarrays with at Least K Equal-Fruit PairsTikTok · OATikTok interview questions
- Consistent LogsRippling · OARippling interview questions
Microsoft interview experiences
- Microsoft OA Questions, October 2026: 4 Experiences
- Microsoft Experienced SWE Phone Screen: 1 Experience
- Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
- Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
- Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
- Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)