9.18 IBM OA interview experience sharing|HackerRank two questions in one go (with questions + ideas)

945 Views

This afternoon just passed the IBM OA, the platform is HackerRank. overall experience, the difficulty than I did a few days ago linen to some simple, given an hour of time, in fact, more than enough, I'm 18 minutes to do all the submission, once through. The following is a brief sharing of the topic and ideas.

9.18 IBM OA interview experience sharing|HackerRank two questions in one go (with questions + ideas)

Question 1: High Load Timestamps

Title requirements

Find all the indices i (0-based) of the timestamps such that the ithi^{\text{th}}ith timestamp is greater than twice the average server load.
The function getHighLoadTimestamps will take one input.
int load[n]. server loads at timestamps
The function should return an array of integers denoting the indices of the timestamps, in increasing order, where load[i] > 2 × average. If none, return an empty array.

Example

n = 3
load = [1, 2, 9]
average = (1+2+9)/3 = 4
2 × average = 8
Only load[2] = 9 > 8
Answer = [2]

Constraints

9.18 IBM OA interview experience sharing|HackerRank two questions in one go (with questions + ideas)
image

Ideas
Directly sum, then average, and finally traverse the array to determine the load[i] > 2 × average The subscripts of can be used, with complexity O(n), in seconds.

Question 2: Minimum Reassignments for Connectivity

Title requirements

You are managing link_nodes Some repositories are already in sync via direct version links. A repository is considered synced with another if they are directly or indirectly connected. A repository is considered synced with another if they are directly or indirectly connected.

You can perform the reassignment of existing links any number of times (possibly zero).

  • Remove one existing link and use it to connect any other pair of repositories.

Implement a function that determines the minimum number of reassignments needed to ensure all repositories are part of a single sync system. If it is not Implement a function that determines the minimum number of reassignments needed to ensure all repositories are part of a single sync system.

Function signature

int minReassignments(int link_nodes, int link_from[], int link_to[])

Example

link_nodes = 4
link_edges = 3
link_from = [1, 1, 3]
link_to = [2, 3, 4]

Ideas
This question is about graph connectivity:

  1. A connected graph requires at least n-1n - 1n-1 edges. If there are not enough edges, return -1.
  2. Otherwise we count how many concatenated blocks there are currently, and maintain them with a concatenated set (Union-Find).
  3. The number of extra edges needed to put all the connected blocks together = the number of connected blocks - 1. Since we are allowed to "reconnect" existing edges, as long as the total number of edges is sufficient, we are guaranteed to have a connected graph.

The overall complexity, O(n α(n)), is sufficient over all data.

IBM OA FAQ

Q: Are the IBM OA questions difficult?
A: The difficulty level is not too big, and the overall level is on the basic side, examining common algorithms and graph theory ideas. If you have prepared for LeetCode medium level questions, you can easily cope with them.

Q: What is the OA platform?
A: This is the HackerRank platform, the interface and operation is similar to the common OA platform.

Q: What questions do I need to brush up on in advance for IBM OA?
A: It is recommended that you focus on preparing for questions related to array simulation, prefix sums, concatenation, graph connectivity, etc. IBM's OA mainly focuses on basic algorithmic skills and is not too fancy.

Q: Is one hour and two questions enough?
A: Absolutely. This time I handed in my paper in 18 minutes, leaving me time to double-check.

Interview/written test support services

Many students encounter these problems when preparing for OA and interviews:

time constraint: It's easy to get stuck on details that lead to timeouts;

train of thought: When you encounter an unfamiliar topic, you don't know how to start at once;

environmental stress: It's easier to get bugs in the real world than to brush up on questions.

Our team is available on a permanent basis:

OA Professional ghostwriter(Full coverage of HackerRank, CodeSignal, Cowboys.com, etc. Guaranteed 100% pass, no charge if you don't pass);

Remote unmarked assists(Real-time voice/prompts to help you avoid potholes at key points);

Full interview escort(VO assistance, mock interviews, reminders of ideas).

Whether it's IBM, Amazon, Citadel, or Two Sigma, we have a wealth of real-world experience to help you pass with flying colors.

author avatar
Jory Wang Amazon Senior Software Development Engineer
Amazon senior engineer, focusing on the research and development of infrastructure core systems, with rich practical experience in system scalability, reliability and cost optimization. Currently focusing on FAANG SDE interview coaching, helping 30+ candidates successfully obtain L5/L6 Offers within one year.
END