POTD Question was https://www.geeksforgeeks.org/problem...
Sort in specific order
Difficulty: Medium Accuracy: 52.55% Submissions: 47K+ Points: 4
Given an array arr[] of positive integers. Your have to sort them so that the first part of the array contains odd numbers sorted in descending order, and the rest of the portion contains even numbers sorted in ascending order.
Examples:
Input: arr[] = [1, 2, 3, 5, 4, 7, 10]
Output: [7, 5, 3, 1, 2, 4, 10]
Explanation: 7, 5, 3, 1 are odd numbers in descending order and 2, 4, 10 are even numbers in ascending order.
Input: arr[] = [0, 4, 5, 3, 7, 2, 1]
Output: [7, 5, 3, 1, 0, 2, 4]
Explanation: 7, 5, 3, 1 are odd numbers in descending order and 0, 2, 4 are even numbers in ascending order.
Constraints:
1 ≤ arr.size() ≤ 10^5
0 ≤ arri ≤ 10^9
Expected Complexities
Time Complexity: O(n log n)
Auxiliary Space: O(1)
#coding #GeeksforGeeks #ProblemOfTheDay #JavaScript
---
introduction:
name: "Jagadeesh Kumar S"
contact: "+91 73972 85837 | [email protected]"
description: "A problem-solving enthusiast passionate about coding challenges."
technical_achievements:
"Solved 100+ daily coding challenges on GeeksforGeeks"
"Ranked in the top 130 on SRM Institute of Science and Technology's GeeksforGeeks leaderboard"
"Maintained a 100+ day streak for Problem of the Day"
github:
contributions: "Solutions available at https://github.com/JKS-sys/Solution-T..."
---
Информация по комментариям в разработке