VOOZH about

URL: https://www.geeksforgeeks.org/videos/problem-of-the-day-14112024-nearly-sorted/

⇱ PROBLEM OF THE DAY : 14/11/2024 | Nearly Sorted - GeeksforGeeks | Videos


November 15, 2024 |5.9K Views

PROBLEM OF THE DAY : 14/11/2024 | Nearly Sorted

Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Arrays but also build up problem-solving skills.

Given an array arr[], where each element is at most k away from its target position, you need to sort the array optimally.

Note: 
 

  1. The given Array can be Circular.
  2. You need to change the given array arr[] in place.

Examples:

Input: arr[] = [6, 5, 3, 2, 8, 10, 9], k = 3 Output: [2, 3, 5, 6, 8, 9, 10] Explanation: The sorted array will be 2 3 5 6 8 9 10

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/nearly-sorted-1587115620/1

Recommendations
2.0K Views | 23/04/2026...
Row with maximum number of 1s
3.5K Views | 10/01/2025...
Get level of a node in binary tree Iterative approach
27.4K Views | 10/01/2025...
Implement two stacks in an array
33.8K Views | 10/01/2025...
Longest Palindromic Subsequence
10.7K Views | 10/01/2025...
Maximum Sum Increasing Subsequence
17.9K Views | 10/01/2025...
Iterative Postorder Traversal
7.2K Views | 10/01/2025...
Sort a linked list of 0s, 1s and 2s
11.5K Views | 09/01/2025...
Segment Tree | Set 2 (Range Minimum Query)
16.7K Views | 09/01/2025...
Convert a given Binary Tree to Doubly Linked List | Set 3
10.2K Views | 08/01/2025...
SDE Sheet - Special Keyboard