左旋转字符串
This commit is contained in:
+18
-13
@@ -35,6 +35,14 @@ public:
|
||||
*/
|
||||
bool is_number(std::string s);
|
||||
|
||||
/**
|
||||
* 剑指 Offer 58 - II. 左旋转字符串
|
||||
*
|
||||
* @url https://leetcode.cn/leetbook/read/illustration-of-algorithm/589fz2/
|
||||
* @param s
|
||||
* @param n
|
||||
* @return
|
||||
*/
|
||||
std::string reverse_left_words(std::string s, int n);
|
||||
};
|
||||
|
||||
@@ -55,6 +63,16 @@ public:
|
||||
|
||||
void reverse_stack(ListNode *head, std::vector<int> &res);
|
||||
void reverse(ListNode *head, std::vector<int> &res);
|
||||
|
||||
/**
|
||||
* 剑指 Offer 24. 反转链表
|
||||
*
|
||||
* @url https://leetcode.cn/leetbook/read/illustration-of-algorithm/9pdjbm/
|
||||
* @param head
|
||||
* @return
|
||||
*/
|
||||
ListNode *reverse_list(ListNode *head);
|
||||
ListNode* reverse_list(ListNode* cur, ListNode* pre);
|
||||
};
|
||||
|
||||
|
||||
@@ -95,19 +113,6 @@ public:
|
||||
private:
|
||||
std::stack<int> _stk;
|
||||
std::stack<int> _min_stk;
|
||||
|
||||
void reverse_stack(ListNode *head, std::vector<int> &res);
|
||||
void reverse(ListNode *head, std::vector<int> &res);
|
||||
|
||||
/**
|
||||
* 剑指 Offer 24. 反转链表
|
||||
*
|
||||
* @url https://leetcode.cn/leetbook/read/illustration-of-algorithm/9pdjbm/
|
||||
* @param head
|
||||
* @return
|
||||
*/
|
||||
ListNode *reverse_list(ListNode *head);
|
||||
ListNode* reverse_list(ListNode* cur, ListNode* pre);
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user