上一页 1 2 3 4 5 6 7 8 9 ··· 63 下一页
摘要: #define min(a,b) ((a)<(b))?(a):(b) int nthUglyNumber(int n){ int nums[1691] = {0}; nums[0]=1; int ugly, i2 = 0, i3 = 0, i5 = 0; for(int i = 1; i < n; 阅读全文
posted @ 2021-01-07 19:21 温暖了寂寞 阅读(64) 评论(0) 推荐(0) 编辑
摘要: class Solution: def singleNumber(self, nums: int) -> List[int]: # difference between two numbers (x and y) which were seen only once bitmask = 0 for n 阅读全文
posted @ 2021-01-06 23:36 温暖了寂寞 阅读(60) 评论(0) 推荐(0) 编辑
摘要: bool searchMatrix(int** matrix, int matrixSize, int* matrixColSize, int target){ int row = matrixSize-1; int col = 0; while (row >= 0 && col < *matrix 阅读全文
posted @ 2021-01-06 15:57 温暖了寂寞 阅读(47) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector<int> productExceptSelf(vector<int>& nums) { int length = nums.size(); vector<int> answer(length); // answer[i] 表示索引 i 阅读全文
posted @ 2021-01-04 00:18 温暖了寂寞 阅读(51) 评论(0) 推荐(0) 编辑
摘要: struct TreeNode* lowestCommonAncestor(struct TreeNode* root, struct TreeNode* p, struct TreeNode* q) { if(root==p || root==q || !root) return root; st 阅读全文
posted @ 2021-01-03 16:48 温暖了寂寞 阅读(53) 评论(0) 推荐(0) 编辑
摘要: int recursion(struct TreeNode* root, int* k,int* ret){ if(!root || *k==0) return *ret; recursion(root->left,k,ret); if(--(*k)==0){ *ret = root->val; } 阅读全文
posted @ 2021-01-03 11:48 温暖了寂寞 阅读(41) 评论(0) 推荐(0) 编辑
摘要: #define max(a,b) ((a)>(b))?(a) :(b); int maxProfit(int* prices, int pricesSize){ if(pricesSize==0) return 0; int i, buy=-prices[0], sell=0, pre=0, tmp 阅读全文
posted @ 2021-01-02 16:27 温暖了寂寞 阅读(56) 评论(0) 推荐(0) 编辑
摘要: bool isAdditiveNumber(char * num){ int i, j, k, len=strlen(num), pst1=0, pst2=0, bit=0, third; char* tmp1=(char*)calloc(22,sizeof(char)); char* tmp2=( 阅读全文
posted @ 2021-01-01 22:21 温暖了寂寞 阅读(88) 评论(0) 推荐(0) 编辑
摘要: typedef struct { int dp[200][200]; } NumMatrix; NumMatrix* numMatrixCreate(int** matrix, int matrixSize, int* matrixColSize) { NumMatrix* obj = (NumMa 阅读全文
posted @ 2020-12-31 22:32 温暖了寂寞 阅读(55) 评论(0) 推荐(0) 编辑
摘要: char * getHint(char * secret, char * guess){ int shash[10]={0}; int ghash[1000]={0}; int i, len=strlen(secret), A=0, B=0, l=0; char* s=(char*)calloc(1 阅读全文
posted @ 2020-12-31 20:54 温暖了寂寞 阅读(96) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 63 下一页