Category: subarray

Print array after it is right rotated K times | Set 2

Given an array arr[] of size N and a value K, the task is to print the array rotated by K times to the right.Examples:Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.  To complete your […]

Continue Reading

Longest subarray with all even or all odd elements

Given an array A[ ] of N non-negative integers, the task is to find the length of the longest sub-array such that all the elements in that sub-array are odd or even.Examples:Input: A[] = {2, 5, 7, 2, 4, 6, 8, 3}Output: 4Explanation: Sub-array {2, 4, 6, 8} of length 4 has all even elementsInput: […]

Continue Reading