---
# System prepended metadata

title: Sprint 2 Module Project 1

---

# Sprint 2 Module Project 1
## buyAndSellStock
```
def buyAndSellStock(prices):
    minPrice = prices[0]
    maxProfit = 0
    for i in range(1, len(prices)):
        if prices[i] - minPrice > maxProfit:
            maxProfit = prices[i] - minPrice
        if prices[i] < minPrice:
            minPrice = prices[i]
    return maxProfit
```

## alphabeticShift
```
letters = {'a': 'b', 'b': 'c', 'c': 'd', 'd': 'e', 'e': 'f', 'f': 'g', 'g': 'h', 'h': 'i', 'i': 'j', 'j': 'k', 'k': 'l', 'l': 'm', 'm': 'n', 'n': 'o', 'o': 'p', 'p': 'q', 'q': 'r', 'r': 's', 's': 't', 't': 'u', 'u': 'v', 'v': 'w', 'w': 'x', 'x': 'y', 'y': 'z', 'z': 'a'}
def alphabeticShift(inputString):
    res = list(inputString)
    for i, char in enumerate(res):
        res[i] = letters[char]
    return ''.join(res)

```

## validParenthesesSequence
```
def validParenthesesSequence(s):
    arr = []
    for char in s:
        if char == '(':
            arr.append('(')
        else:
            if len(arr) == 0:
                return False
            arr.pop()
    return len(arr) == 0
```