ypqhappy
ypqhappy
全部文章
分类
数据结构学习(17)
生活(2)
题目知识点(2)
题解(41)
归档
标签
去牛客网
登录
/
注册
ypqhappy的博客
就决定是你啦!
全部文章
(共59篇)
题解 | #字符逆序#
#include <iostream> using namespace std; string strReverse(string &s) { int j = s.length() - 1; for (int i = 0; i < j; i++, j--)...
字符串
2021-04-14
1
532
(C++)使用非递归方法解决(递归方法代码上面也有,但没有调用)
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ class Solution { public: /** *...
二叉树
2021-04-07
6
895
很啰嗦的ifififififififif...
class Solution { public: /** * * @param s string字符串 * @return bool布尔型 */ bool isValid(string s) { // write code ...
字符串
2021-04-07
1
611
快慢指针(总会追上的)
class Solution { public: bool hasCycle(ListNode *head) { if (head == nullptr || head->next == nullptr) return false; ...
链表
2021-04-06
1
478
使用辅助栈来解决(其中的pre的用处理解很重要)
方法:使用栈 把两个链表压入到栈1和栈2; 栈的最上面元素依次相加,并压入到另一个栈3; 如果栈1见底了,那么保证边界(最后的pre等于1)的同时把栈2剩下的全送到栈3;如果栈2见底则同理。 把栈3中的元素全打入新链表(过程是通过链表指针 l 的指针 pNode )。 /** * struct...
链表
2021-04-05
0
634
简单问题的简单思路
/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } };*/ class Solution { public...
链表
2021-04-05
1
546
简单题目用简单思路
class Solution { public: /** * * @param prices int整型vector * @return int整型 */ int maxProfit(vector<int>& price...
动态规划
2021-04-05
1
470
简单题的简单思路
class Solution { public: /** * max sum of the subarray * @param arr int整型vector the array * @return int整型 */ int maxsumofS...
动态规划
2021-04-05
1
499
使用链表指针的指针,单纯简单顺下来的思路
/** * struct ListNode { * int val; * struct ListNode *next; * }; */ class Solution { public: /** * * @param l1 ListNode类 ...
链表
2021-04-05
0
438
最小的几个数:先快排,再传给给新数组,返回
class Solution { public: int getStandard(vector<int>& array, int low, int high) { int key = array[low]; while(low &l...
数组
2021-04-03
0
494
首页
上一页
1
2
3
4
5
6
下一页
末页