2014年9月13日

[leetcode]Sudoku Solver @ Python

摘要: 原题地址:https://oj.leetcode.com/problems/sudoku-solver/题意:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated b... 阅读全文

posted @ 2014-09-13 10:23 AIDasr 阅读(739) 评论(0) 推荐(0) 编辑

2014年9月12日

3Sum and 4Sum @ Python Leetcode

摘要: 1)3Sumhttps://oj.leetcode.com/problems/3sum/Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the a... 阅读全文

posted @ 2014-09-12 10:18 AIDasr 阅读(235) 评论(0) 推荐(0) 编辑

2014年9月5日

[EPI] The knapsack problem with Python [17.7]

摘要: Reference:http://rosettacode.org/wiki/Knapsack_problem/0-1#Dynamic_programming_solutiontime complexity: O(limit*len(items))space complexity: O( limit... 阅读全文

posted @ 2014-09-05 10:16 AIDasr 阅读(290) 评论(0) 推荐(0) 编辑

2014年9月4日

[EPI] maximize fishing [17.5] python

摘要: def maximizeFishing(A): for i in range(len(A)): for j in range(len(A[0,:])): A[i][j] += max(0 if i < 1 else A[i - 1][j], 0 if j <... 阅读全文

posted @ 2014-09-04 07:07 AIDasr 阅读(119) 评论(0) 推荐(0) 编辑

2014年8月28日

[leetcode]Single Number @ Python

摘要: 原题地址:http://www.cnblogs.com/x1957/p/3373994.html题意:Given an array of integers, every element appearstwiceexcept for one. Find that single one.要求:线性时间复... 阅读全文

posted @ 2014-08-28 10:34 AIDasr 阅读(190) 评论(0) 推荐(0) 编辑

2014年8月25日

Unique Paths @ Python Leetcode EPI 17.4

摘要: Unique PathsA robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right a... 阅读全文

posted @ 2014-08-25 06:03 AIDasr 阅读(244) 评论(0) 推荐(0) 编辑

2014年8月23日

compute Binomial Coefficient or combinations with dynamic programming

摘要: The ProblemWrite a function that takes two parameters n and k and returns the value of Binomial Coefficient C(n, k).For example, your function should ... 阅读全文

posted @ 2014-08-23 12:17 AIDasr 阅读(316) 评论(0) 推荐(0) 编辑

Edit Distance (or Levenshtein Distance) python solution for leetcode EPI 17.2

摘要: https://oj.leetcode.com/problems/edit-distance/Edit DistanceGiven two wordsword1andword2, find the minimum number of steps required to convertword1tow... 阅读全文

posted @ 2014-08-23 09:34 AIDasr 阅读(1046) 评论(1) 推荐(0) 编辑

导航