![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode学习与总结
Parkergh
这个作者很懒,什么都没留下…
展开
-
<Leetcode 2T >
题目我的题解看到题解都是每遍历一次就申请一次内存,内存的代价太高,故采用修改值,最后进位时申请一次内存的方式class Solution {public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { int tag=0,t=0; ListNode* head=new ListNode(0),*pre=head; while(l1 || l2){ i原创 2021-03-20 21:47:39 · 107 阅读 · 5 评论 -
leetcode 代码总结(c++)
leetcode 代码总结(c++)1、C++中如何访问字符串中的单个字符#include <iostream>int main(int argc,const char* argv[]){ std::string str1 = "Hello World!"; //向访问字符数组那样,将字符串中的第二个字符提取出来显示,如果下标越界,不会报告错误。 std::cout ...原创 2019-11-30 17:13:55 · 584 阅读 · 0 评论