- 博客(8)
- 收藏
- 关注
原创 264. 丑数 II
int nthUglyNumber(int n){ int p2=1, p3=1, p5=1; int dp[n+1]; dp[1] = 1; int num2, num3, num5; for(int i=2;i<=n;i++){ num2 = dp[p2] * 2; num3 = dp[p3] * 3; num5 = dp[p5] * 5; dp[i] = fmin(fmin(num2,num.
2021-09-21 16:15:17
124
原创 268. 丢失的数字
int missingNumber(int* nums, int numsSize){ int i; int *hash = (int *)calloc(numsSize+1,sizeof(int)); //int hash[numsSize + 1]; //memset(hash, 0, sizeof(hash)); for (i = 0; i < numsSize; i++) { hash[nums[i]]++; } for.
2021-09-18 15:44:06
164
原创 200. 岛屿数量
void dfs(char** grid, int m, int n, int x, int y){ if(grid[x][y]=='1'){ grid[x][y]='0'; if((x+1<m) && (grid[x+1][y]=='1')){ dfs(grid,m,n,x+1,y); } if((x-1>=0) && (grid[x-1][y]=='1')){ .
2021-09-17 19:14:19
111
原创 如何对Firefox拓展程序进行修改
想要对现有的火狐拓展程序进行修改,首先是找到位于C:\Users\xxxx\AppData\Roaming\Mozilla\Firefox\Profiles\xxxx.default-release\extensions目录下的对应xpi文件(相当于Chrome的crx文件)将后缀名改为zip后解压,或是直接在压缩包中对其中的js文件进行修改并保存,然后将后缀重新修改回xpi。然而将该文件拖入Firefox进行安装时会出现文件已损坏的提示,这是由于修改该xpi内的任何文件都会导致其中的签名文件失效。fi
2021-07-30 06:41:35
1271
原创 118. 杨辉三角
给定一个非负整数 numRows,生成杨辉三角的前 numRows 行。在杨辉三角中,每个数是它左上方和右上方的数的和。示例:输入: 5输出:[[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]int** generate(int numRows, int* returnSize, int** returnColumnSizes){ int** nr = malloc(sizeof(int*)*numRows); //int** 建立矩阵
2021-06-25 05:37:36
271
原创 3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is “abc”, with the length of 3.Example 2:Input: "bbbbb"Output: 1Explanation: The answer is “b”, with the
2021-04-21 17:49:45
108
原创 2. Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.You may assume the two numbers do no
2021-04-21 17:35:17
161
原创 1. Two Sum
1. Two SumGiven an array of integers, return indices of the two numbers suchthat they add up to a specific target.You may assume that each input would have exactly one solution, andyou may not use the same element twice.Example:Given nums = [2, 7, 1
2021-04-05 16:44:41
142
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅