In this challenge, the task is to debug the existing code to successfully execute all provided test files.
Given an array of n distinct integers, transform the array into a zig zag sequence by permuting the array elements. A sequence will be called a zig zag sequence if the first k elements in the sequence are in increasing order and the last k elements are in decreasing order, where k = (n+1)/2. You need to find the lexicographically smallest zig zag sequence of the given array.
Example.
a = [1,3,2,5,4]
Now if we permute the array as [1,4,5,3,2], the result is a zig zag sequence.
Debug the given function findZigZagSequence to return the appropriate zig zag sequence for the given input array.
Note: You can modify at most three lines in the given code. You cannot add or remove lines of code.
Смотрите видео HackerRank | 1 Week Preparation Kit | Zig Zag Sequence hackerrank solution in python | Day 3 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Engineers Revolution 08 Январь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,984 раз и оно понравилось 10 людям.