## 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

## Bash Matrix Solution CodeChef

Bash Matrix Solution February Challenge 2021 A Bash matrix is a matrix with NN rows (numbered 11 through NN) and NN columns (numbered 11 through NN), where for each row rr and column cc, the cell in row rr and column cc (denoted by (r,c)(r,c)) contains one of the characters ‘U’, ‘D’, ‘L’ or ‘R’. Also See: February Long Challenge 2021 Solutions We can move in the matrix while treating the characters as … 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 You are given an array of non-negative integers arr and a start index. When you are at an index i, you can move left or right by arr[i]. Your task is to figure out if you can reach value 0. Also See: Microsoft Online Assessment Questions and Solution Example 1: Input: arr = [3, 4, 2, 3, 0, … Read more

## Microsoft OA Widest Path Without Trees Solution

Microsoft OA Widest Path Without Trees Solution There are N trees (numbered from 0 to N-1) in a forest. The K-th tree is located at coordinates (X[K], Y[K]). We want to build the widest possible vertical path, such that there is no tree on it. The path must be built somewhere between a leftmost and a rightmost tree, which means that the width … Read more