Sliding Window Maximum Algorithm (To track the maximum of each subarray of size k)
Problem:- Write an algorithm to track the maximum of each subarray of size k in time complexity O(n) and space complexity O(k), where n is the size of the array and k is size of the window ...

## Array

### 18

###### Sep

### 18

###### Sep

Problem Statement : To find the maximum sum of circular subarray in contiguous circular array.
Prerequisite : Kadane’s Algorithm
Examples :
Input : 10 -3 -4 7 6 5 -4 -1
Output : 23 (7+6+5-4-1+10)
Input : 10 -3 -4 5 -4 -2 7 6 5 -4
Output : 24 (10+7+6+5-4)
In this problem, there can ...

### 17

###### Sep

Binary Search for Infinite Array
Problem:- Given an array of integer write an algorithm to find the element entered by the user for searching. Take input from the user and return the index of the element (Array size in unknown).
input: arr[] ...

### 17

###### Sep

Problem: Given an array of integer write an algorithm to find the element which is to be searched. Take input from the user and return the index of the element.
int [] arrA = {1,3,5,0,6,9,4,1,2};
Enter the element to be searched :- 5
Output: Element found at index: 3
Naïve approach:-
This approach searches the element ...

### 16

###### Sep

Problem:. Write an algorithm to count all the possible sub arrays where product of all the elements in the sub array is less than k. You are given with an interger array and a value 'k'.
Example:
Int [] nums = {5, 3, 2, 4};
K = 100
Output: 11
Sub arrays: [5], [5 3], ...

### 12

###### Sep

In this post , we will learn how to find the majority element in the array.
There are number of ways with which we can find the majority element in an array.
A majority element is a element which appears more than n/2 times in the array.
Solution 1:
The first solution is to ...

“Programming is a skill best acquired by practice and example rather than from books.”

#### Quick Links

#### Sign Up

Make sure you don’t miss interesting happenings

by joining our portal for coders.

**Code4Run**- All right reserved. © 2018. Don't copy it, it's a bad karma.