# LeetCode Contest 169

class Solution:
def sumZero(self, n: int) -> List[int]:
ans = []
if n & 1:
ans.append(0)
for i in range(1, n//2 + 1):
ans.append(i)
ans.append(-i)
return ans


# LeetCode Contest 167

# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution:
def getDecimalValue(self, head: ListNode) -> int:
r = 0
r = r * 2 + head.val
return r


# 2018， 在路上

2018年，一直在路上，特别是在I-71。I-71是一条跨州的高速公路，从南端肯塔基州的路易斯维尔(Louisville, Kentucky)东北延向俄亥俄州的克里夫兰(Cleveland, Ohio)，全长约345迈。之前每逢夏天，便约上几个好友沿着I-71开车到克里夫兰，或是参观艺术博物馆，或是听音乐会，又或是去那个不甚似国家公园的国家公园骑自行车。到了今年，那些个好友也已经有好几个毕业离开了。虽然少了好友一起在I-71路上寻找悠闲，但是I-71对我来说有了它新的意义：它变成了李之仪的长江。

# Simple Grid Detection for Sudoku

Sudoku is a very interesting puzzle, and it is very easy to get familiar with the rules of the game. I always like to compare sudoku with number theory, they are easy to be understood but can be hard to solve. Fermat's Last Theorem, an easily understood problem even by middle school students, took mathematians 358 years to solve it completely. Solving sudoku puzzles can take even longer: it is proven that solving sudoku puzzels is an NP-complete problem! However, classical 9x9 sudoku puzzles are still feasible using backtracking algorithm. We are not going to talk about how to solve sudoku puzzles here though, we are trying to sovle another problem: detect grids in images containing sudoku puzzles.

To make the problem more concrete, let's make some assumption on the image that contains a sudoku puzzle:

1. The image only contains one sudoku puzzle
2. The sudoku puzzle is the largest block in the image
3. There is no/little distorsion/rotation of the sudoku puzzle grid

Also in this article, we focus on only simple solutions without heavy image processing. We will use Pillow to read images and convert them to gray scale images, and we use Numpy to manipulate images as arrays. For visualization, we use Matplotlib.