Skip to content

Instantly share code, notes, and snippets.

View zwfang's full-sized avatar
📝
Know that it is you who will get you where you want to go, no one else.

zwfang

📝
Know that it is you who will get you where you want to go, no one else.
  • Remote
View GitHub Profile
@zwfang
zwfang / word_search.py
Last active December 7, 2018 08:41
word search
#!/usr/bin/env python3
"""
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once.
Example:
board =
[
@zwfang
zwfang / combine.py
Last active December 7, 2018 07:12
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
#!/usr/bin/env python3
import copy
class Solution:
def __init__(self):
self.res = []
def combine(self, n, k):
"""
@zwfang
zwfang / knight_tour.c
Created November 21, 2018 10:20
骑士周游问题,深度优先遍历+递归,
/************************************************************/
/** 马踏棋盘算法(骑士周游问题) **/
/************************************************************/
#include <stdio.h>
#include <time.h>
#define X 8
#define Y 8