Find duplicates in an given array in O(n) time and O(1) extra space.

Objective: Given an array of integers, find out duplicates in it. Example: int [] a = {4, 6, 2, 1, … Read more

Find the last repeating character in a given string.

Objective: Given a string, write an algorithm to find the last repeating character in it. Example: String input = “horizon … Read more

Find Whether Two Strings are Permutation of each other

Objective: Given Two Strings, check whether one string is a permutation of other

Input: Two Strings

Output: True or false based on whether strings are permutations of others or not.

Example:

"sumit" and "tiums" are permutations of each other.

"abcd" and bdea" are not permutations of each other.

Approach:


Method 1: Time Complexity – O(nlgn)

Read more