Check Even-Position Monotonicity
Reported by candidates from TikTok's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The TikTok OA reported in June 2026 looks like a trick question, but it reduces to one thing: pull out every other element and check if that sequence strictly goes up or strictly goes down. That's it. No fancy structure, just a single pass and two flags. If you've got an invite and you're bracing for something brutal, relax a bit. The risk here isn't difficulty, it's sloppy edge cases. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but this one is mostly about reading the statement carefully and not overthinking it.
The problem
Given an array of non-negative integers numbers, check whether the elements at even positions are monotonic. The even-positioned elements are numbers[0], numbers[2], numbers[4], and so on. They are monotonic if they are either strictly increasing or strictly decreasing. Return "increasing" if the even-positioned elements are strictly increasing, "decreasing" if they are strictly decreasing, or "none" if they are not monotonic. A solution with time complexity not worse than O(numbers.length^2) fits within the execution time limit. Function solution(numbers: int[]) → String Examples Example 1 numbers = [12, 65, 15, 72, 19, 72] return = "increasing" Elements at even positions are numbers[0], numbers[2], and numbers[4], i.e. 12, 15, and 19. Since 12 < 15 < 19, the answer is "increasing". Example 2 numbers = [12, 1, 54, 5, 19, 14] return = "none" Elements at even positions are numbers[0], numbers[2], and numbers[4], i.e. 12, 54, and 19. These values are not monotonic, so the answer is "none". Example 3 numbers = [666, 17, 66, 5, 6, 23] return = "decreasing" Elements at even positions are numbers[0], numbers[2], and numbers[4], i.e. 666, 66, and 6. Since 666 > 66 > 6, the answer is "decreasing". Constraints numbers is an array of non-negative integers.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Walk indices 0, 2, 4 and so on. Compare each even-positioned element to the previous one. Keep two booleans, canIncrease and canDecrease. If the next value is not greater, canIncrease goes false. If it's not smaller, canDecrease goes false. Equal values kill both, which matters because the problem says strictly. At the end, return "increasing" if canIncrease is still true, "decreasing" if canDecrease is, otherwise "none". The classic pitfall is the short case. With one even-positioned element, or an empty array, both flags stay true and you have to decide what to return. The statement doesn't spell it out, so pick a deliberate rule and don't let the code fall through by accident. Another trap is checking odd indices or all adjacent pairs. O(n) is plenty here. If you freeze in the live OA, StealthCoder can hand you this loop as a hedge, but you should be able to write it cold.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Check Even-Position Monotonicity cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass TikTok's OA.
TikTok reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Check Even-Position Monotonicity FAQ
How hard is the TikTok even-position monotonic question really?+
Easy. It's one pass over the array with step 2 and two flags. The only thing that trips people is strictness, since equal neighbors make the sequence non-monotonic, and the tiny-array cases. Read the statement twice and you're fine.
What's the trick to solving it?+
Don't build a new array unless you want to. Loop i from 2 in steps of 2, compare numbers[i] to numbers[i-2], and track whether increasing and decreasing are still possible. Whichever flag survives is your answer, or return none.
How should I handle arrays with fewer than three elements?+
Then there are zero or one pairs of even-positioned elements to compare, so both flags stay true. The statement gives no rule for this, so decide explicitly. Check the constraints and examples in your version of the problem, and pick a consistent return rather than relying on accidental fallthrough.
Does equal values between even positions count as monotonic?+
No. The problem says strictly increasing or strictly decreasing. If two even-positioned elements are equal, both directions fail and the answer is none. Use strict greater-than and less-than comparisons, never greater-or-equal.
How do I prepare for this in 48 hours?+
Write this solution once from scratch, then test it on the three given examples plus a tiny array and a case with duplicates. After that, spend your time on general array and flag-tracking problems. Don't grind hard problems for a question this simple.