![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode
D-wade.陈
哭着来到这个世界,就要笑着离开。
展开
-
Leetcode链表1
这个题的思路很巧妙,要删除这个节点,那么就将该节点的下一个节点的值拿来赋给该节点,然后使用两个next跳过下一个节点即可,这样就达到了“删除”的效果。 /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ void deleteNode(struct ListNode* node) { struct ListNode.原创 2021-02-17 17:00:41 · 75 阅读 · 0 评论 -
Leetcode20:有效的括号
本题可通过C++中的链栈来解决: class Solution { public: bool isValid(string s) { stack<char> linkstack; int length = s.size(); if (length == 0) return true; if (length % 2) return false; li...原创 2020-04-06 11:31:22 · 89 阅读 · 0 评论 -
Leetcode:面试题10- II. 青蛙跳台阶问题
进入题目 一. 动态规划 class Solution { public: int numWays(int n) { //vector+1是要存储0至n共n+1个数据。 vector<int> v(n + 1, 1); for(int i = 2; i <= n; i++) v[i] = (v[i...原创 2020-04-02 11:09:54 · 165 阅读 · 0 评论