码迷,mamicode.com
首页 >  
搜索关键字:solution upgrade    ( 13024个结果
02 add two numbers
02 add two numbers 1. 题目讲解 给定两个链表,每个链表表示一个整数,求这两个整数之和。结果也还是用链表表示。 2. 题解 思路: ? 本质上这道题是两个数带进位的加法。两个对应位置上的和是和对10取余。进位则是和整除10. class Solution { public: Li ...
分类:其他好文   时间:2021-04-06 14:12:17    阅读次数:0
Solution -「CF 392C」Yet Another Number Sequence
Description Link. 求 \(\sum_{i=1}^{n}\text{fibonacci}_{i}\times i^{k}=\sum_{i=1}^{n}(F_{i-1}+\text{fibonacci}_{i-2})\times i^{k}\),\(1\le n\le10^{17},1 ...
分类:其他好文   时间:2021-04-06 14:07:28    阅读次数:0
160. 相交链表
题目链接 解题思路:双指针 C++: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} ...
分类:其他好文   时间:2021-04-06 14:05:05    阅读次数:0
31. 下一个排列 + 双指针 + 思维
31. 下一个排列 LeetCode_31 题目描述 题解分析 代码实现 class Solution { public void nextPermutation(int[] nums) { int i = nums.length - 2; while(i >= 0 && nums[i] >= nu ...
分类:其他好文   时间:2021-04-06 14:03:32    阅读次数:0
PTA 面向对象程序设计6-2 统计数字
对于给定的一个字符串,统计其中数字字符出现的次数。 类和函数接口定义: 设计一个类Solution,其中包含一个成员函数count_digits,其功能是统计传入的string类型参数中数字字符的个数并返回。 裁判测试程序样例: #include <cstdlib> #include <cstdio ...
分类:其他好文   时间:2021-04-05 12:37:04    阅读次数:0
Best Time to Buy and Sell Stock
暴力求解法,直接遍历求最大值 class Solution { public: int maxProfit(vector<int>& prices) { int maxprofit=0; for(int i=0;i<prices.size();i++) { for(int j=i+1;j<price ...
分类:其他好文   时间:2021-04-05 11:41:37    阅读次数:0
[Docker] MACVLAN Network 簡介
此篇文章介紹 Docker MACVLAN Network 及其運作方式 環境介紹 以下的測試將會在以下環境進行: OS:Ubuntu 18.04 Docker: 18.03.1-ce 網卡配置: eth0:10.103.19.0/24 eth1:trunk port (10.103.[17-18] ...
分类:Web程序   时间:2021-04-02 13:35:18    阅读次数:0
用两个栈实现队列
解题思路: 栈是先进后出,队列是先进先出 # -*- coding:utf-8 -*- class Solution: # 初始化栈为空列表 def __init__(self): self.acceptStack=[] self.outputStack=[] def push(self, node ...
分类:其他好文   时间:2021-04-02 13:32:05    阅读次数:0
1588. 所有奇数长度子数组的和
暴利求解法 设置tem记录每个元素的累加和,当为奇数的时候,将tem值与sum值累加,完成所有遍历,即所有奇数长度子数组的和 class Solution { public int sumOddLengthSubarrays(int[] arr) { int sum=0; if(arr.length ...
分类:编程语言   时间:2021-04-02 13:31:40    阅读次数:0
leetcode1006.笨阶乘
不难 class Solution { public: int clumsy(int N) { int i; if(N==3) return 6; if(N==2||N==1) return N; int a=N*(N-1)/(N-2)+N-3; N-=4; int sign=1; long lon ...
分类:其他好文   时间:2021-04-02 13:02:35    阅读次数:0
13024条   上一页 1 ... 16 17 18 19 20 ... 1303 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!