Sharechat Hiring Test OA | Wave Generation | Coding Problems & Answers
Question · Posted Apr 2026
Wave Generation The physicists of Hackerland are working on an algorithm to create waves. An array can be represented as a wave if either of the following conditions is satisfied: a1 > a2 and a2 < a3 and a3 > a4 and so on. OR a1 < a2 and a2 > a3 and a3 < a4 and so on. where a[i] is the i-th element of the array. Given an array arr of n integers, consisting of integers in range ...
The full answer & interview discussion are available to premium members.
Log in Create a free account