0

For examples sake:

Array: [a][b][c][d][e][r][e][p][l][a][c][e][m][e][o][p][q][r][s][t]

Array to put in: [f][g][h][i][j][k][l][m][n]

Solved Array: [a][b][c][d][e][f][g][h][i][j][k][l][m][n][o][p][q][r][s][t]

These aren't the values i'm using in my original code, so don't answer based on the alphabet or anything.

Thanks

adeneo
  • 312,895
  • 29
  • 395
  • 388
  • you would run a loop (call it loop 1) checking for insertion location, once found then run another loop (call it loop 2) that runs the length of the second array and inserts its values at the index position of your first loop (loop 1). Hope that helps a bit. – Austin Jun 18 '14 at 20:49
  • 1
    Or you could just concat the arrays and run a filter to weed out dupes. – adeneo Jun 18 '14 at 20:50
  • underscore has uniq Produces a duplicate-free version of the array, using === to test object equality. If you know in advance that the array is sorted, passing true for isSorted will run a much faster algorithm. If you want to compute unique items based on a transformation, pass an iterator function. – Daniel Jun 18 '14 at 20:51

0 Answers0