07 2020 档案
摘要:题目 class Solution { public: bool isPowerOfThree(int n) { double x = log10(n) / log10(3); return n>0 && (abs((int)x - x) < 0.000000000000001); } };
阅读全文
摘要:题目 这道题目很有意思,有意思的是使用O(n)的时间效率和O(1)的空间效率解决。我会写一篇专业的博客来介绍一下 以下就是O(n)的时间效率和O(1)的空间效率。 class Solution { public: int n; int findKth(vector<int>& nums, int s
阅读全文
摘要:题目 动态规划 class Solution { public: int dp[10005]; int coinChange(vector<int>& coins, int amount) { memset(dp,-1,sizeof(dp)); dp[0] = 0; for(int i=1;i<=a
阅读全文
摘要:题目 动态规划 class Solution { public: string dp1[100005]; string _dp1[100005]; string dp2[100005]; string bp1[100005]; string _bp1[100005]; string bp2[1000
阅读全文
摘要:题目 找规律 const int MAXN = 2e5; class Solution { public: long long square[MAXN]; int pos=0; int bulbSwitch(int n) { for(long long i=1;i<MAXN;i++) { if(i*
阅读全文