码迷,mamicode.com
首页 >  
搜索关键字:solution    ( 11547个结果
[leetcode]Insertion Sort List @ Python
原题地址:http://oj.leetcode.com/problems/insertion-sort-list/题意:对链表进行插入排序。解题思路:首先来对插入排序有一个直观的认识,来自维基百科。 代码循环部分图示:代码:class Solution:# @p...
分类:编程语言   时间:2014-07-22 23:11:32    阅读次数:411
Subsets
Problem 1:Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set ...
分类:其他好文   时间:2014-05-01 09:43:43    阅读次数:414
Leetcode | Valid Sudoku & Sudoku Solver
判断valid,没有更好的方法,只能brute force。 1 class Solution { 2 public: 3 bool isValidSudoku(vector > &board) { 4 5 int n; 6 for (int...
分类:其他好文   时间:2014-05-01 08:54:28    阅读次数:332
[leetcode] Minimum Path Sum
思路很简单,就是存储之前运算的结果,然后递归class Solution {public: int** dp; int get_min_sum(vector > &grid, int m, int n) { if (dp[m][n] != -1) ...
分类:其他好文   时间:2014-05-01 07:54:47    阅读次数:330
Letter Combinations of a Phone Number
思路很简单,就是通过map对应,随后通过递归调用,这里遇到了个问题就是开始用string &re ,然后往里传re+c是不可以的,本来想省点内存,结果不行,所以只能值传递了,后来才知道string竟然还有push_back()和pop_back(),服了。 1 class Solution { 2 ...
分类:其他好文   时间:2014-04-29 19:31:07    阅读次数:524
Leetcode:Add Binary 二进制相加
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 思路同十进制的大数相加。代码如下: class Solution { public: string addBinary(string a, str...
分类:其他好文   时间:2014-04-29 13:12:20    阅读次数:328
Conceptual Blockbusting Intro & chap1
Page 6:Natural tendency in problem solving is to pick the first solution that comes to mind and run with it. The disadvantage of this approach is you ...
分类:其他好文   时间:2014-04-27 21:27:40    阅读次数:510
11547条   上一页 1 ... 1153 1154 1155
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!