Question: IBM Online Assessment (OA) Coding Questions & Solutions | HackerRank Aug2025
1
Entering edit mode

Question 1: Find Maximum Bandwidths

Problem Statement:

A service provider manages n API endpoints, each serving different functionalities, numbered from 1 to n. Given m bandwidth units, allocate these among the endpoints.

The objective is to maximize the bandwidth allocated to the k-th endpoint while meeting the following conditions:

  • All bandwidth units must be allocated.

  • Each endpoint must have at least 1 unit of bandwidth allocated.

  • The absolute difference in bandwidth between any two adjacent endpoints cannot exceed 1.

Return the maximum possible bandwidth that can be allocated to the k-th endpoint satisfying all conditions.

Example:

n = 4

k = 3

m = 17

One optimal way to distribute m = 17 units of bandwidth among the n = 4 endpoints is [3, 4, 5, 5]. Here, the 3rd endpoint is allocated 5 units of bandwidth. Hence, 5 is the required answer.

 

Question 2: Substrings with No Repeating Characters

Problem Statement:

Given a string s, determine how many different substrings exist that have no repeating characters. Two substrings are considered different if they have different start or end indices.

Example:

s = "abac"

The substrings with no repeating characters are "a", "b", "a", "c", "ab", "ba", "ac", and "bac".

Note that "aba" and "abac" do not qualify because the character 'a' is repeated in them. Also, "a" and "a" both qualify because their start indices are different: s[0] and s[2]. There are 8 such substrings.

 

Sample Cases:

  • s = "bcada" output: 12

  • s = "abcd"  Output: 10

ADD COMMENTlink 2 hours ago admin 1.8k

Login before adding your answer.

Similar Posts
Loading Similar Posts