Counting Zigzag Sequences
CodeChefOpen on judge ↗
Given an array A1, A2, ..., AN of integers, count number of "Zig-zag" sub-sequences in it. A sub-sequence of array A is obtained by deleting greater than or equal to zero elements and preserving the order of remaining elements. So, a sub-sequence of length K can by defined by a sequence of indices b1, b2, ..., bK such that 1 ≤ b1 2 K ≤ N. A "Zig-zag" sequence is a sub-subsequence of odd length a
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start