摘要:
class Solution { public: int nthUglyNumber(int n) { int a = 0; int b = 0; int c = 0; vector<int> res(n,1); for(int i = 1; i < n; i++){ int temp = min( 阅读全文
posted @ 2021-08-18 21:36
三一一一317
阅读(36)
评论(0)
推荐(0)
摘要:
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), rig 阅读全文
posted @ 2021-08-18 15:03
三一一一317
阅读(132)
评论(0)
推荐(0)
摘要:
class Solution { public: vector<vector<int>> res; vector<vector<int>> permute(vector<int>& nums) { vector<int> temp; for(int i = 0; i < nums.size(); i 阅读全文
posted @ 2021-08-18 14:59
三一一一317
阅读(45)
评论(0)
推荐(0)
摘要:
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2021-08-18 14:58
三一一一317
阅读(51)
评论(0)
推荐(0)
摘要:
参考: https://leetcode-cn.com/problems/factorial-trailing-zeroes/solution/xiang-xi-tong-su-de-si-lu-fen-xi-by-windliang-3/ class Solution { public: int 阅读全文
posted @ 2021-08-18 14:56
三一一一317
阅读(47)
评论(0)
推荐(0)
摘要:
三面列举了三种不同最小值所在的位置,可以看出只要当前元素为1,那么dp[i][j]就等于左上,左、上,中的最小值加1。 比如图一种最小值为3。问号所在位置元素为1,那么dp问号处的值就为4,因为当取三者最小值的时候,其余两个4,4所在位置的元素肯定为1。不然此处的dp值肯定比3还小。 class S 阅读全文
posted @ 2021-08-18 13:54
三一一一317
阅读(52)
评论(0)
推荐(0)
摘要:
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2021-08-18 12:34
三一一一317
阅读(61)
评论(0)
推荐(0)
摘要:
class Solution { public: int maxSubArray(vector<int>& nums) { int res = INT_MIN; int sum = 0; for(int i = 0; i < nums.size(); i++){ if(sum<=0){ sum = 阅读全文
posted @ 2021-08-18 11:53
三一一一317
阅读(43)
评论(0)
推荐(0)
摘要:
class Solution { public: void moveZeroes(vector<int>& nums) { int i = 0; int j = 0; while(j<nums.size()){ if(nums[j]!=0){ swap(nums[i],nums[j]); i++; 阅读全文
posted @ 2021-08-18 11:44
三一一一317
阅读(39)
评论(0)
推荐(0)
摘要:
class Solution { public: /* 小于10,1~9,9个数字,9位 小于100,10~99,90个数字,180位 小于1000,100~999,900个数字,2700位 */ int findNthDigit(int n) { long digit = 1; // 用来记录n属 阅读全文
posted @ 2021-08-18 11:33
三一一一317
阅读(60)
评论(0)
推荐(0)

浙公网安备 33010602011771号