IBM Coding Question – Solved

12 Live
getQueryAnswers In a machine learning model, there are n data entries stored in the model's output cache cacheEntries. Each entry contains three values: 1. timestamp – when the prediction was made. 2. modelId – the identifier of the machine learning model. 3. predictionValue – the model's output, represented as a string containing an integer. A query handler receives q queries in the form of queries[q][2], where each query consists of: - modelId – identifying the machine learning model. - timestamp – specifying the time at which the prediction was made. Implement a function getQueryAnswers that: - Takes two inputs: - cacheEntries[n][3]: A list of cached predictions. - queries[q][2]: A list of queries. - Returns an array of integers, where each value corresponds to the predictionValue for the given modelId and timestamp.

Asked in: IBM

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| You are given a board of size M Γ— N where each cell can be either empty ('O') o… |
| Undirected Coloured Graph Shortest Path You are given an undirected weight… |
| Village Voyage A computer game "Village Voyage" has N villages (labeled 1 to… |
| Academic Decathlon Students are being selected for an academic decathlon tea… |
| Sum of Arrays Given two arrays each of length n, arr1 and arr2, in one opera… |
| Count Swaps During Custom Sorting Analyze the efficiency of the following so… |