Agoda Online Assessment Questions...
Anonymous User
303

These are the questions from Agoda's online assessment for intern role.

  • Problem 1: Minimum Length Subarray with K Consecutive Values

Description:
You are given a permutation arr of length n (containing integers from 1 to n) and an integer k.

A subarray is considered valid if you can pick exactly k elements from it such that, after reordering, they form k consecutive integers.

Return the minimum length of any valid subarray.

Example:
Input:
arr = [10, 1, 6, 8, 7, 2, 5, 9, 3, 4]
k = 5

Output:
6

  • Problem 2: Count of Palindromic Substrings

Description:
Given a string s, return the total number of palindromic substrings in it.

A substring is a contiguous sequence of characters.

Example:
Input:
s = "abcbd"

Output:
6

  • Problem 3: Count of Subarrays with Fixed Min and Max

Description:
You are given an integer array arr and two integers min_price and max_price.

Return the number of subarrays such that:

  • The minimum element in the subarray equals min_price
  • The maximum element in the subarray equals max_price

Example:
Input:
arr = [1, 5, 6, 5]
min_price = 5
max_price = 6

Output:
3

Comments (1)