- 博客(15)
- 资源 (9)
- 问答 (2)
- 收藏
- 关注
原创 【leetcode】Text Justification
Question 我觉得还是翻译一下好 给一个字符串数组,一个L整数 1、一行最多有L个字符 2、把这些字符串尽可能多得放在一行 3、每个字符串之间都有空格分开 4、字符串之间空格的个数平均分配,如果不能除尽,那么左边的空格数大于右边的 5、最后一行字符串左对齐,之间以一个空格分隔,剩余用空格补齐TipsNo way, just let it be complex : )Codecla
2015-05-31 10:32:17 379
原创 【leetcode】Unique Paths II
QuestionTipsI think still use dynamic programming.class Solution {public: int uniquePathsWithObstacles(vector<vector<int> >& obstacleGrid) { int m = obstacleGrid.size(); int n = ob
2015-05-30 02:13:10 427
原创 【leetcode】Unique Paths
QuestionTips Using the dynamic programmingCodeclass Solution {public: int uniquePaths(int m, int n) { int **res; res = new int*[m]; for(int i = 0; i < m; ++i){
2015-05-30 01:00:54 357
原创 【iOS】自定义对象深拷贝、浅拷贝
问题情境 其实这是学习ios第二天,看了斯坦福大学的2013年秋季iOS公开课,做了一个纸牌匹配小游戏。其中遇到的问题不少,关于object-c的学习就不再赘述,其中的一个问题我觉得在这里记一笔,对今后有帮助——自定义对象的深拷贝、浅拷贝。 我有一个CCard类,用一个NSMutableArray来保存,我打算在牌堆中随机挑选6张牌(屏幕就打算放12张),再随机放入NSMutableArray中。我
2015-05-20 21:28:32 2283
原创 [Linux]内存共享
API头文件#include <shm.h>创建共享内存int shmget(key_t key, size_t size, int shmflg);key:键值,有效地为共享内存段命名 size:申请内存的大小获取创建好的共享内存void *shmat(int shm_id,const void *shm_addr, int shmflg);shm_id:由shmget创建返回的共享内存id
2015-05-18 19:26:04 382
原创 【Linux】MySQL C语言操作
C语言访问MySQL头文件#include <mysql.h>API//通常传递NULL,返回一个指向连接句柄的指针;如果传进去一个已有的结构,它将被重新初始化 MYSQL mysql_init(MYSQL );//连接数据库 MYSQL *mysql_real_connect(MYSQL *connection,//由mysql_init初始化的指针 const char *server_h
2015-05-12 23:37:02 401
原创 【LeetCode】Rotate list
QuestionMethod1 Using to pointers to make the distance equal k%ListNode.length()//This is got from a loop/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *
2015-05-12 22:57:13 336
原创 【Linux】mmap函数的内存映射
API#include <sys/mman.h>mmap//将文件映射到内存 void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);成功:返回一个地址指针。 失败:返回MAP_FAILED参数说明addr:指定分配内存的起始地址,0时由OS决定len:需要分配的内存长度prot :期望的内存保
2015-05-08 19:29:00 562
原创 N-Queens && N-Queens II
QuestionTipsBacktracking //You know ,I can do it well : ) Codeclass Solution {public: Solution(){ res.clear(); rec=NULL; } ~Solution(){ if(rec!=NULL) delete []rec;
2015-05-06 20:18:53 358
原创 【LeetCode】Anagrams
QuestionTipsHash tableCodeclass Solution {public: vector<string> anagrams(vector<string>& strs) { res.clear(); ht.clear(); if(strs.size()<=1) return res;
2015-05-05 20:34:49 402
原创 【POJ】Parencodings
ParencodingsTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 21004 Accepted: 12590Description Let S = s1 s2…s2n be a well-formed string of parentheses. S can be encoded in two d
2015-05-05 17:11:00 377
原创 Rotate Image
Questionclass Solution {public: void rotate(vector<vector<int> >& matrix) { for(int layer=0;layer<matrix.size()/2;++layer){ //View matrix like many circles int row=matrix.size()-2*l
2015-05-05 13:57:09 270
原创 【LeetCode】Permutations II
QuestionTipsStill the backtrackingSource Codeclass Solution {public: void BT(int d,vector<int> &nums){ if(d==nums.size()){ vector<int> t; for(int i=0;i<tmp.size();++i)
2015-05-05 11:19:51 332
原创 【LeetCode】Permutations
QuestionTips BacktrackingCodeclass Solution{ public: void BT(int depth,vector<int> &nums){ if(depth==nums.size()){ res.push_back(tmp); return; }else{ for(int i
2015-05-04 23:00:03 297
原创 【linux】终端音乐播放器
简介 这次其实是经历一些面试之后决定要从windows的训练下脱离出来,去linux下试试手了。但是对linux下的编程工具只知道VI,没办法,可视化界面我想现在暂时是做不出了。还有,我coding都喜欢听着歌曲,这样不容易被外界干扰。于是乎,就打算做一个Terminal Music Player。困难 要说困难,最大的困难就是从windows用习惯了的Visual Studio下脱离出来,没有代
2015-05-04 21:49:46 1903
Vitamio Demo
2015-07-29
Terminal-Music-Player
2015-05-05
LED8*8点阵驱动
2014-11-17
linux重定向到终端输入输出
2015-04-28
大牛们,请问如何用windows API实现对文本文件的字符删除修改?
2015-04-05
TA创建的收藏夹 TA关注的收藏夹
TA关注的人