This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i=0 | |
while read x | |
do | |
arr[$i]=$x | |
i=$i+1 | |
done | |
echo ${arr[@]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i=0 | |
while read x | |
do | |
arr[$i]=$x | |
i=$i+1 | |
done | |
echo ${arr[@]:3:5} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i=0 | |
while read x | |
do | |
arr[$i]=$x | |
i=$i+1 | |
done | |
arr=(${arr[@]//*a*}) | |
arr=(${arr[@]//*A*}) | |
if [ ${#arr[@]} -eq 0 ] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i=0 | |
while read x | |
do | |
arr[$i]=$x | |
i=$i+1 | |
done | |
arr=(${arr[@]} ${arr[@]} ${arr[@]}) | |
echo ${arr[@]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i=0 | |
while read x | |
do | |
arr[i]=$x | |
i=$i+1 | |
done | |
echo ${arr[3]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i=1 | |
while read word | |
do | |
words[i]=$word | |
i=$(( $i + 1 )) | |
done | |
echo ${words[@]/[A-Z]/.} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = raw_input() | |
s = s.lower() | |
is_pangram = lambda s: not set('abcdefghijklmnopqrstuvwxyz') - set(s.lower()) | |
if is_pangram(s) == True: | |
print "pangram" | |
else: | |
print "not pangram" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
height = 1 | |
N = [] | |
for _ in xrange(int(raw_input())): | |
N.append(int(raw_input())) | |
for item in N: | |
if item == 0: | |
print 1 | |
else : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
# Complete the function below. | |
def maxXor( l, r): | |
largest = 0 | |
for i in xrange(l, r+1): | |
for j in xrange(l, r+1): | |
if (i^j) > largest: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#tweet is a single tweet | |
def clean_tweet(tweet): | |
tweet = re.sub("https?\:\/\/", "", tweet) #links | |
tweet = re.sub("#\S+", "", tweet) #hashtags | |
tweet = re.sub("\.?@", "", tweet) #at mentions | |
tweet = re.sub("RT.+", "", tweet) #Retweets | |
tweet = re.sub("Video\:", "", tweet) #Videos | |
tweet = re.sub("\n", "", tweet) #new lines | |
tweet = re.sub("^\.\s.", "", tweet) #leading whitespace | |
tweet = re.sub("\s+", " ", tweet) #extra whitespace |