Skip to content

Instantly share code, notes, and snippets.

@duraz0rz
Last active December 11, 2015 11:18
Show Gist options
  • Save duraz0rz/4592313 to your computer and use it in GitHub Desktop.
Save duraz0rz/4592313 to your computer and use it in GitHub Desktop.
public boolean has12(int[] nums) {
boolean has1 = false;
boolean has2 = false;
for (int i = 0 ; i < nums.length ; ++i) {
if (nums[i] == 1)
{
has1 = true ;
}
else if (has1 && nums[i] == 2)
{
has2 = true ;
}
}
return has2 ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment