摘要: char * simplifyPath(char * path){ char *stack[100]; int size = 0; for (char *s = strtok(path, "/"); s; s = strtok(NULL, "/")) { if (strcmp(s, ".") == 阅读全文
posted @ 2020-12-11 21:29 温暖了寂寞 阅读(85) 评论(0) 推荐(0) 编辑
摘要: #define min(a,b) ((a)<(b))?(a):(b); int minPathSum(int** grid, int gridSize, int* gridColSize){ for (int i=gridSize-1; i>=0; i--){ for (int j=(*gridCo 阅读全文
posted @ 2020-12-11 17:43 温暖了寂寞 阅读(84) 评论(0) 推荐(0) 编辑
摘要: int uniquePathsWithObstacles(int** obstacleGrid, int obstacleGridSize, int* obstacleGridColSize){ double* arr=(double*)calloc(*obstacleGridColSize,siz 阅读全文
posted @ 2020-12-11 16:26 温暖了寂寞 阅读(79) 评论(0) 推荐(0) 编辑
摘要: int uniquePaths(int m, int n){ int* arr=(int*)calloc(n,sizeof(int)); arr[n-1]=1; int i; while(m-->0){ for(i=n-1; i>=0; i--){ arr[i]+=(i+1<n)?arr[i+1] 阅读全文
posted @ 2020-12-11 12:21 温暖了寂寞 阅读(50) 评论(0) 推荐(0) 编辑
摘要: struct ListNode* rotateRight(struct ListNode* head, int k){ if(!head) return NULL; struct ListNode* arr[1000]; int cnt=0, i, n; while(head){ arr[cnt++ 阅读全文
posted @ 2020-12-11 11:36 温暖了寂寞 阅读(74) 评论(0) 推荐(0) 编辑
摘要: int** generateMatrix(int n, int* returnSize, int** returnColumnSizes){ *returnSize=n; int** arr=(int**)calloc(n,sizeof(int*)); *returnColumnSizes=(int 阅读全文
posted @ 2020-12-11 10:36 温暖了寂寞 阅读(92) 评论(0) 推荐(0) 编辑
摘要: int cmp(const void*a, const void*b){ return (*(int**)a)[0] > (*(int**)b)[0]; } int** merge(int** intervals, int intervalsSize, int* intervalsColSize, 阅读全文
posted @ 2020-12-11 00:38 温暖了寂寞 阅读(97) 评论(0) 推荐(0) 编辑