Alteryx | DSA
Anonymous User
356

Question 1
Problem: Total Binary Subarrays with Ratio x : y
You are given a binary array nums and two positive integers x and y.

Your task is to count the number of contiguous subarrays of nums in which the number of 1s and 0s is in the exact ratio of x : y.

Definition
A subarray satisfies the ratio x : y if:
count(1s) / count(0s) == x / y

Input
nums: an array of integers of length n (1 <= n <= 10^5), where each element is either 0 or 1.

x: an integer (1 <= x <= 10)

y: an integer (1 <= y <= 10)

Output
Return a single integer — the number of contiguous subarrays that satisfy the ratio condition x : y.

Question 2: Given array of xCordinates and yCordinates get the count of right angled triangles formed using those points

Comments (2)