Skip to content

Instantly share code, notes, and snippets.

@p53ud0k0d3
Created March 19, 2015 13:57
Show Gist options
  • Save p53ud0k0d3/6710850ca0722096d96c to your computer and use it in GitHub Desktop.
Save p53ud0k0d3/6710850ca0722096d96c to your computer and use it in GitHub Desktop.
HackerRank Filter An Array With Patterns
i=0
while read x
do
arr[$i]=$x
i=$i+1
done
arr=(${arr[@]//*a*})
arr=(${arr[@]//*A*})
if [ ${#arr[@]} -eq 0 ]
then
echo
else
echo $arr
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment