---
# System prepended metadata

title: Write a small function that finds the smallest palindrome number greater than N for which its power of 2 is a palindrome as well.

---

Yassir / Jan

# Write a small function that finds the smallest palindrome number greater than N for which its power of 2 is a palindrome as well.

``` python
def isPalindrome(s):
    return s == s[::-1]
    

def smallest_palindrome(N):
    i = N + 1
    while True:
       if isPalindrome(str(i)) and isPalindrome(str(i**2)):
           return i
        i += 1
        
# 123n  

# 12 % 10
 2
121
def list_from_number(n):
    result = []
    
    while True:
        digit = n % 10
        result.append(digit)
        n = n // 10

```
# You have N tasks to run in any order you want.Each task takes one time step to run. There must be a minimum of K (cooldown value) time steps between two runs of the same task. Write a function that returns the sequence of tasks to run in a minimal amount of time steps.

# 1) tasks = ["A", "A", "B"], K = 3 -> ["A", "B", "", "", "A"]
# 2) tasks = ["A","A","B","B","C", "C"], K = 1 -> ["A", "B", "C", "A", "B", "C"]
# 3) tasks = ["A", "B", "B", "C"], K = 4 -> ["B", "A", "C", "", "", "B"]


# [B, A, A, A, C, D, F, G, B]
``` python
[A, B, ]


from collections import Counter


def find_minimum_seq(tasks, K):
    counter = Counter(tasks)
    max_vals = counter.most_common()
    result = [max_val]
    i = 0
    while True:
        if i > len(max_vals) :
            
        else:
            result.append(max_vals[i])
        
    