## Trees Height Solution Amazon OA SDE

Trees Height Solution Amazon OA SDE There are N trees in Jon’s backyard and height of tree i is h[i]. Jon doesn’t like the appearance of it and is planning to increase and decrease the height of trees such that the new heights are in strictly increasing order. Every day he can pick one tree … Read more

## Microsoft OA Fair Indexes Solution

Microsoft OA Fair Indexes Solution You are given two arrays A and B consisting of N integers each. Index K is named fair if the four sums(A+…A[K-1]),(A[K]+…+A[N-1]),(B+…+B[K-1]) and (B[K]+…+B[N-1]) are all equal, In other words, K is the index where the two arrays, A and B, can be split (into two non-empty arrays each) in … Read more

## Microsoft OA Jump Game Solution

Microsoft OA Jump Game Solution Given an array of non-negative integers arr, you are initially positioned at start index of the array. When you are at index i, you can jump to i + arr[i] or i – arr[i], check if you can reach to any index with value 0. Notice that you can not jump outside of the array at any time. Also See: … Read more

## Microsoft OA Widest Path Without Trees Solution

Microsoft OA Widest Path Without Trees Solution There are N trees in the forest (numbered from 0 to N-1). The Kth tree is located at coordinates (X[k], Y[k]).We want to build the largest possible vertical path so that there is no tree. The path must be established somewhere between the leftmost tree and the rightmost … Read more

## Microsoft OA Arithmetic Slices Solution

Microsoft OA Arithmetic Slices Solution An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, [1,3,5,7,9], [7,7,7,7], and [3,-1,-5,-9] are arithmetic sequences. Given an integer array nums, return the number of arithmetic subarrays of nums. A subarray is a contiguous subsequence of the array. Also See: Microsoft Online Assessment Questions … Read more