A
Anonymous

Ramp Length Calculator - Copy this React, Tailwind Component to your project

A ramp in an array arr of size n is defined as a pair (i, j) s. t 0<= i < j < n and arr[i] <= arr[j]. The Length of the ramp is equal to (j i+1). Given the array arr , what is the maximum length of a ramp in the arr . if there is no ramp in the array print 1. Input First line contains a single integer N. Second line contains N space separated integer denoting array arr. Constraints: 1 <= N <= 10^5 0 <= arr[i] <= 10^5 Output A single integer denoting required answer. Example Input: 6 7 8 5 4 9 6 Output: 5 explanation: (0, 1), (0, 4), (1, 4), (2, 4), (2, 5), (3, 5) are pairs of indices which forms different ramps. ramp (0, 4) has the maximum length of 5.

Prompt
Component Preview

About

RampLengthCalculator - Calculate the maximum ramp length in an array with ease. Built with React and Tailwind for seamless UI. Download instantly!

Share

Last updated 1 month ago