Uber | Phone Screen | Sub Counting
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2024-07-07Added By Anonymous
Source: Link
Company: Uber
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: unknown
Original Post Content:
Given an array A of length n and a 2D array B which consists of m queries.
Each query is one of the following two types:
• Type 1- L R 0: Find the number of non-decreasing subarrays in the range from L to R.
• Type 2 - L R X: Replace every element in the range from L to R with X where X != 0.
Find the sum of answers to queries of Type 1