Skip to content

Category Archives: Arrays

  Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements.   Rotation of the above array by 2 will make… Read More
  Given an array (or string), the task is to reverse the array/string.Examples :   Input : arr[] = {1, 2, 3} Output : arr[] =… Read More
  There are 2 sorted arrays A and B of size n each. Write an algorithm to find the median of the array obtained after… Read More
There are two sorted arrays. First one is of size m+n containing only m elements. Another one is of size n and contains n elements.… Read More
Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12,… Read More
You are given a list of n-1 integers and these integers are in the range of 1 to n. There are no duplicates in the… Read More
Given an array of positive integers. All numbers occur an even number of times except one number which occurs an odd number of times. Find… Read More
Given an array arr[] consisting of positive integers that occur even number of times, except one number, which occurs odd number of times. The task… Read More
Write a function which takes an array and prints the majority element (if it exists), otherwise prints “No Majority Element”. A majority element in an… Read More