• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
March 05, 2024 |1.7K Views
PROBLEM OF THE DAY : 04/03/2024 | Largest Number formed from an Array
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Karan Mashru. 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 Array but also build up problem-solving skills.

In this problem, we are given an array arr of n positive integers. The task is to swap every ith element of the array with (i+2)th element.

Example :

Input:
n = 3
arr[] = 1 2 3
Output:
3 2 1

Explanation:
Swapping 1 and 3, makes the array 3 2 1. There is only one swap possible in this array.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/need-some-change/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp14-compiler/eefd0a3d-60e3-4f88-951f-11fc808ec6f6

Read More