Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Instructions.count solution in Clear category for Follow Instructions by Striga
def follow(instructions):
x = instructions.count('r') - instructions.count('l')
y = instructions.count('f') - instructions.count('b')
return (x, y)
if __name__ == '__main__':
assert follow("fflff") == (-1, 4)
assert follow("ffrff") == (1, 4)
assert follow("fblr") == (0, 0)
Nov. 11, 2020