Tutorials
Go Premium
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.0K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Strings
2.1K+ articles
C++ Programs
1.5K+ articles
Greedy
1.4K+ articles
array-rearrange
470+ articles
rotation
415+ articles
Constructive Algorithms
215+ articles
Swap-Program
40 posts
Recent Articles
Popular Articles
Minimum adjacent swaps of digits required to make N divisible by K
Last Updated: 28 July 2022
Given two integers N and K, the task is to calculate the minimum number of adjacent swaps of digits required to make the integer N divisible by K.Examples:Input: N = 12345...
read more
Mathematical
Combinatorial
C++ Programs
DSA
divisibility
number-digits
Swap-Program
Swapping two numbers using template function in C++
Last Updated: 27 December 2021
A significant benefit of object-oriented programming is the reusability of code which eliminates redundant coding. An important feature of C++ is called templates. Templat...
read more
C++
CPP-Functions
Swap-Program
Count of distinct strings that can be obtained after performing exactly one swap
Last Updated: 07 June 2025
Given a string s containing lowercase characters. The task is to calculate the number of distinct strings that can be obtained after performing exactly one swap.Input: s =...
read more
Strings
Algo Geek
Algo-Geek 2021
DSA
Arrays
Swap-Program
Minimum swaps to group all 0s together in Binary Circular Array
Last Updated: 28 January 2022
Given a binary circular array arr[] of size N, the task is to find the minimum swaps to group all 0s together in the array.Examples:Input: arr[] = {1, 0, 1, 0, 0, 1, 1}Out...
read more
DSA
binary-representation
sliding-window
circular-array
Swap-Program
Minimize swap between same indexed elements to make given Arrays strictly increasing
Last Updated: 20 July 2022
Given two arrays arr1[] and arr2[] of size N each, the task is to find the minimum number of interchange of the same indexed elements required to make both arrays strictly...
read more
Dynamic Programming
DSA
Arrays
Swap-Program
Check if array can be sorted by swapping adjacent elements of opposite parity
Last Updated: 28 February 2022
Given an array A of size n, the task is to check if the array can be sorted in increasing order, if the only operation allowed is swapping the adjacent elements if they ar...
read more
Bit Magic
Sorting
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
Swap-Program
Swap given nodes in a Doubly Linked List without modifying data
Last Updated: 05 July 2022
Given a doubly linked list having all unique elements and two keys X and Y, the task is to swap nodes for two given keys by changing links only.Note: It may be considered ...
read more
DSA
doubly linked list
Swap-Program
Lexicographically smallest Binary String formed using infinite swaps
Last Updated: 24 February 2023
Given a binary string s of length N, the task is to find the lexicographically smallest string using infinite number of swaps between 0's and 1's.Examples:Input: s = "1001...
read more
Strings
Bit Magic
Greedy
Sorting
Combinatorial
DSA
binary-string
lexicographic-ordering
Swap-Program
Minimize cost to bring maximum element at Kth position by swapping
Last Updated: 21 June 2022
Given two integers N and K and an array of N positive integers (i.e., a0, a1, a2...., an-1), the task is to find the minimum cost to bring maximum value to Kth position by...
read more
Mathematical
Picked
DSA
Arrays
Swap-Program
C++ Program to Swap characters in a String
Last Updated: 18 August 2023
Given a String S of length N, two integers B and C, the task is to traverse characters starting from the beginning, swapping a character with the character after C places ...
read more
C++
rotation
Constructive Algorithms
Swap-Program
Java Program to Swap characters in a String
Last Updated: 06 April 2023
The task at hand involves manipulating a string S of length N, given as input. The string is subjected to a series of B swaps, each performed according to the following pr...
read more
Java
rotation
Constructive Algorithms
Swap-Program
Python3 Program for Swap characters in a String
Last Updated: 05 September 2024
Given a String S of length N, two integers B and C, the task is to traverse characters starting from the beginning, swapping a character with the character after C places ...
read more
Python
rotation
Constructive Algorithms
Swap-Program
Javascript program to swap two numbers without using temporary variable
Last Updated: 28 May 2024
To swap two numbers without using a temporary variable, we have multiple approaches. In this article, we are going to learn how to swap two numbers without using a tempor...
read more
JavaScript
Bitwise-XOR
Swap-Program
JavaScript-Questions
Minimizing Swaps for Adjacent pair Sum Difference in Permutation
Last Updated: 23 December 2023
Given a permutation P of length n. The task is to find the minimum number of swaps required in the permutation such that the difference between the maximum value of (P[i] ...
read more
Geeks Premier League
DSA
Arrays
Data Structures
Swap-Program
Geeks Premier League 2023
Swap Two Numbers Without Third Variable in C++
Last Updated: 14 February 2024
In C++, swapping two numbers means we need to exchange the value of two numbers. In this article, we will learn how to swap two numbers without using the third variable in...
read more
C++ Programs
C++
Picked
Swap-Program
CPP Examples
1
2
3
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !