Skip to content

Instantly share code, notes, and snippets.

View deepakdodo's full-sized avatar

Deepak GR deepakdodo

  • National Instruments R&D
  • Bangalore
View GitHub Profile
#matrix = [ [1, 1, 1], [1, 1, 1], [1, 1, 1] ]
#rows = 3
#cols = 3
#src = (0, 0)
#dest = (2, 2)
class Maze:
def __init__(self, matrix, rows, cols, src, dest):
self.matrix = matrix
matrix = [ [1, 1, 0], [0, 1, 0], [0, 1, 1] ]
rows = 3
cols = 3
src = (0, 1)
dest = (2, 2)
def find_path(x, y):
if x >= rows or y >= cols or x < 0 or y < 0:
return False
@deepakdodo
deepakdodo / gist:2171957
Created March 23, 2012 15:44
Problem C. T9 Spelling: Code Jam
alphas = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def get_pattern(test_str):
key_pad = dict()
ite_alpha = 0 #iterates over all alphabets
digits = 2 #digits varialble takes values from 2-9
ntimes = 1 #number of time you need to print a particular alphabet. Eg. to print 'b' print '2' twice
#Make a Dictionary of all patterns and store it in 'key_pad'.
#Eg: key_pad['b'] = '22'
@deepakdodo
deepakdodo / ai-class.py
Created October 12, 2011 20:31
Download lecture videos of ai-class (with Subtitles) (Stanford)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Deepak.G.R."
__license__ = 'Public Domain'
"""
usage:
Go to command line and type
python ai-class.py "topic-name"