Tutorialspoint.dev
Welcome To Tutorialspoint.dev
Officially launched 18th May 2019
Greedy Python Strings

Rearrange a string so that all same characters become d distance away

Given a string and a positive integer d. Some characters may be repeated in the given string. Rearrange characters of the given string such that the same characters b...
Hash Strings palindrome

Check if characters of a given string can be rearranged to form a palindrome

Given a string, Check if characters of the given string can be rearranged to form a palindrome. For example characters of “geeksogeeks” can be rearrang...
Greedy Heap Strings

Rearrange characters in a string such that no two adjacent are same

Given a string with repeated characters, task is rearrange characters in a string so that no two adjacent characters are same. Note : It may be assumed that the strin...
Greedy Python Strings

Rearrange a string so that all same characters become d distance away

Given a string and a positive integer d. Some characters may be repeated in the given string. Rearrange characters of the given string such that the same characters b...
Sorting array-rearrange Insertion Sort

Rearrange positive and negative numbers with constant extra space

Given an array of positive and negative numbers, arrange them such that all negative integers appear before all the positive integers in the array without using any a...
Arrays Hash array-rearrange

Rearrange an array such that arr[i] = i

Given an array of elements of length N, ranging from 0 to N – 1. All elements may not be present in the array. If element is not present then there will be -1 ...
Arrays array-rearrange Sorting Quiz

Rearrange array such that arr[i] >= arr[j] if i is even and arr[i]<=arr[j] if i is odd and j < i

Given an array of n elements. Our task is to write a program to rearrange the array such that elements at even positions are greater than all elements before it and e...
Arrays Sorting array-rearrange

Rearrange positive and negative numbers using inbuilt sort function

Given an array of positive and negative numbers, arrange them such that all negative integers appear before all the positive integers in the array without using any a...
Arrays Sorting array-rearrange

Rearrange array such that even positioned are greater than odd

Given an array A of n elements, sort the array according to the following relations : , if i is even. , if i is odd. Print the resultant array. Examples...
Arrays array-rearrange Arrays

Rearrange array in alternating positive & negative items with O(1) extra space Set 1

Given an array of positive and negative numbers, arrange them in an alternate fashion such that every positive number is followed by negative and vice-versa maintaini...

Subscribe to Our Newsletter