Skip to content

Instantly share code, notes, and snippets.

@ssartell
Created May 1, 2019 19:31
Show Gist options
  • Select an option

  • Save ssartell/1529ee3c5d80a80a187133f20e511552 to your computer and use it in GitHub Desktop.

Select an option

Save ssartell/1529ee3c5d80a80a187133f20e511552 to your computer and use it in GitHub Desktop.
/* LINQ Puzzle #17 *******************************************************
Summary: Given two lists of integers, determine if the second list is found in the first while allowing values to come inbetween elements
of the second list. In other words, can the first list be created purely by inserting integers into the second?
Sample: { 0, 1, 6, 4, 5, 6, 4, 9, 8 }, { 6, 4, 4, 8 } => true
{ 0, 1, 6, 4, 5, 6, 4, 9, 8 }, { 0, 8 } => true
{ 0, 1, 6, 4, 5, 6, 4, 9, 8 }, { 4, 5, 1 } => false, while all the integers are in the list, they are out of order
************************************************************************/
var first = new int[] { 0, 1, 6, 4, 5, 6, 4, 9, 8 };
var second = new int[] { 6, 4, 4, 8 };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment