Skip to content

Instantly share code, notes, and snippets.

@jianminchen
Created January 4, 2018 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jianminchen/0f5c0f34450970ac116977cf357bcb8c to your computer and use it in GitHub Desktop.
Save jianminchen/0f5c0f34450970ac116977cf357bcb8c to your computer and use it in GitHub Desktop.
need to go over those questions and then figure out things to work on
given 2 vectors with multiple repitions, calc dot product, and create a data structure [2, 1,1 , 1] , [2, 1, 1, 1], [2 *2, 1* 1, 1 * 1, 1 * 1] -> dot product
[2,1 (a million times)]
[1, 2, 1000,000, 100,000 + 1] -> binary search ->
[(1,2), (million, 1)] <- new ds (1, 2), (2, 1), ..., (1000,000, 1)
typedef struct pair{
int value;
int amount;
}Pair;
int dotProduct(Pair v1[], Pair v2[]){
// write this function
}
given two vectors which are sparse, calc dot product, and create a data structure
three sum to a target in an array ->
you are given a bunch of tasks, and a int k
ABAA k = 3
when you complete the tasks, you must complete the tasks in order, but when you schedule a new task, the same task type cannot exist in the past k slots. if it does, you must wait and try again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment