-
LeetCode OJ--Rotate Image
摘要:http://oj.leetcode.com/problems/rotate-image/将矩阵顺时针旋转90度。要求为原地算法。注意对输入的测试,矩阵为空,长度为1,为2时……#include #include using namespace std;class Solution {public: void rotate(vector > &matrix) { if(matrix.empty()) return; vector >matrixB; vector onePiece; int len = matr...
阅读全文
-
python,django,mysql学习之环境安装配置
摘要:参考:https://docs.djangoproject.com/en/1.6/intro/tutorial01/http://rainyang.blog.51cto.com/469543/1152597按照英文教程一步步来,然后遇到问题了再去百度或者google。
阅读全文
-
Python初见
摘要:参考资料:http://wenku.baidu.com/link?url=_akpT-G5Tvf7ECyszSipOAhHXzjlpYu-RWPcRTYp_tecPOollPGUxXG4MH69MLNEgWf1aVLFCz65QxL-yph3r0MFCiHJ81I3SWHM8yhBl4O下面是一些语法: 1 __author__ = 'wrq' 2 #coding = utf-8 3 4 import time 5 print("Hello!") 6 7 '定义函数' 8 def test(): 9 nowTime = time.time()
阅读全文
-
LeetCode OJ——Remove Duplicates from Sorted List
摘要:http://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/链表的去重,要考虑链表的本质。#include using namespace std;struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} };class Solution {public: ListNode *deleteDuplicates(ListNode *head) { if(!head) ...
阅读全文
-
LeetCode OJ——Word Break
摘要:http://oj.leetcode.com/problems/word-break/动态规划题目,重点是建立出模型来:fun(start,end) = fun(start,i)*fun(i+1,end);二维动态数组的申请: int len = s.length(); int **flag = new int *[len]; for(int i = 0;i#include #include using namespace std;class Solution {public: bool fun(string s,unordered_set &dict,int start,int e.
阅读全文
-
文件处理
摘要:在做软件度量作业的过程中,遇到了文件中上千条记录的处理。程序如下:C++的读文件字符串取子串等#include #include #include #include using namespace std;int main(){ fstream fin; string filename = "E:\\002Validate Binary Search Tree\\Debug\\bugs-2013-11-30.csv"; fin.open(filename); if(fin.bad()) { cout count; while(!fin...
阅读全文
|