Daily-Coding-DS-ALGO-Practice
Daily-Coding-DS-ALGO-Practice copied to clipboard
Beautiful Array (LeetCode)
Details
An array nums of length n is beautiful if:
- nums is a permutation of the integers in the range [1, n].
- For every 0 <= i < j < n, there is no index k with i < k < j where 2 * nums[k] == nums[i] + nums[j].
Given the integer n, return any beautiful array nums of length n. There will be at least one valid answer for the given n.
Link to the problem: https://leetcode.com/problems/beautiful-array/
Example 1:
Input: n = 4 Output: [2,1,4,3]
This problem is from Leetcode. I would like to solve this problem in Java language. Please assign this problem to me under LGMSoC'21.
Please assign this issue to me under LGM-SoC'21 @ravikr126 @sameeksharl @Amit366 @Ayush7614
Please Assign me as I am a participant of LGMSOC'21 @Ayush7614 I used Python3