Back to problems

Check Value Occurrence by Position and Half

Algorithm · Upstart · Easy

Problem Statement You're given an integer value and an integer array nums of even length. Produce four 0/1 flags that answer these questions: Even-index check — output 1 if value occurs at any even index in nums (0‑based), otherwise 0. Odd-index check — output 1 if value occurs at any odd index in nums, otherwise 0. First‑half check — output 1 if value is present in the first half of the array, otherwise 0. Second‑half check — output 1 if value is present in the second half…

Checking your access…