Your question is Embedding Index Sort and Optimization. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given embeddings, perform an index sort (ascending and descending) and write the code in Notepad, then optimize the approach.
Asked in the VP Technical Interview stage. Focus was on DSA fundamentals, hash maps/hashing, and optimization thinking.
Implement a function that takes a list of numeric embedding scores and returns the indices that would sort the list in ascending order and in descending order.
def sort_embedding_indices(embeddings):
embeddings: a list of integers or floatsascending: indices sorted by embedding value from smallest to largestdescending: indices sorted by embedding value from largest to smallestIf two values are equal, preserve their original relative order in both outputs.
def sort_embedding_indices(embeddings):