## Fair Indexes Microsoft OA 2023

Fair Indexes Solution Microsoft OA 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

## Jump Game Microsoft OA 2023

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. Example 1: Input: arr … Read more

## Widest Path Without Trees Microsoft OA 2023

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 tree, which … Read more

## Arithmetic Slices Microsoft OA 2023

Arithmetic Slices Solution Microsoft OA 2023 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. Example 1: Input: nums = … Read more

## Particle Velocity Microsoft OA 2023

Particle Velocity Solution Microsoft OA You are a programmer in a scientific team doing research into particles. As an experiment, you have measured the position of a single particle in N equally distributed moments of time. The measurement made in moment K is recorded in an array particles as particles[K]. Now, your job is to count all the periods of time when … Read more