摘要: 直接判断,循环遍历,只要是前面是空格并且自己不为空,就是个新单词。 class Solution { public: int countSegments(string s) { int flag=1; int count=0; for(int i=0; i<s.length();i++) { if( 阅读全文
posted @ 2021-03-08 16:47 章大佬 阅读(23) 评论(0) 推荐(0)
摘要: 很简单的题,一个个遍历,将当前节点的next设成上一个节点,依次类推。 class Solution { public: ListNode* reverseList(ListNode* head) { ListNode*prev=NULL; ListNode*curr=head; while(cur 阅读全文
posted @ 2021-03-08 16:17 章大佬 阅读(24) 评论(0) 推荐(0)