Re:To apply, solve the following... are you kidding?
by phektus on Friday September 30, 2011 @10:22AM
(#3057099)
[ Parent
| on HN ]
Re:To apply, solve the following... are you kidding?
by achompas on Friday September 30, 2011 @11:55AM
(#3057441)
My first pass (assumes input file is an arg):
import sys
def first_unique(word):
if len(word) == 0:
return "EOF"
for i in range(0, len(word)-1):
return word[i] if word[i] != word[i+1]
return "NA"
def main():
with open(sys.argv[1],'r') as f:
print first_unique(f.readline())
Re:To apply, solve the following... are you kidding?
by epicureanideal on Saturday October 01, 2011 @03:59PM
(#3060952)
This seems pretty inefficient, as it seems that line.count would be checking the whole line for how many times the letter appears. However, if you're solving in Python I guess efficiency is not really top priority anyway, and they also didn't specify a language or efficiency.