Previous question · 724
Top Department Salary
easyDatabase
Next question · 726
Percentage of Total
easyDatabase
Random coding question

725. Batched query retrieval

medium
GeneralGeneral
staff
Function contract
Inputs
k
int
docs
np.ndarray
queries
np.ndarray
Returns
value
np.ndarray

Examples

Input
{
  "k": 2,
  "docs": [
    [
      1,
      0,
      0
    ],
    [
      0.8,
      0.2,
      0
    ],
    [
      0,
      1,
      0
    ],
    [
      0,
      0.9,
      0.1
    ]
  ],
  "queries": [
    [
      1,
      0,
      0
    ],
    [
      0,
      1,
      0
    ]
  ]
}
Output
[
  [
    0,
    1
  ],
  [
    2,
    3
  ]
]

Constraints

Hint 1
Hint 2
Hint 3
Roles
ML Engineer
AI Engineer
Data Scientist
Research Scientist
Companies
GeneralGeneral
Levels
staff
senior
entry
Tags
cosine-similarity
top-k-retrieval
numpy-vectorization
stable-sorting

Similar Questions

Linear Regressionmedium
ML Coding
Activation function relueasy
ML Coding
Text normalizationmedium
ML Coding
35 people are solving this problem
Loading editor for the selected language
Ln 1, Col 1
Program Output
DATAINTERVIEW
Interactive coding terminal
Python / NumPy environment ready.
Type a command below or run code from the editor.
run scriptExecute the current editor contents
submitGrade the current editor contents against all solution test cases
python ("print hello world")Run an isolated Python command
helpShow all available commands