Daily-Coding-DS-ALGO-Practice icon indicating copy to clipboard operation
Daily-Coding-DS-ALGO-Practice copied to clipboard

Beautiful Array (LeetCode)

Open Karnika06 opened this issue 3 years ago • 2 comments

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.

Karnika06 avatar Jul 29 '21 13:07 Karnika06

Please assign this issue to me under LGM-SoC'21 @ravikr126 @sameeksharl @Amit366 @Ayush7614

Karnika06 avatar Jul 29 '21 13:07 Karnika06

Please Assign me as I am a participant of LGMSOC'21 @Ayush7614 I used Python3

suy1968 avatar Aug 02 '21 17:08 suy1968