我正在尝试为 instapy 编写一个代码,以便通过标签对帖子进行点赞和评论。它显示标签页面但不与帖子交互。我的代码:
session = InstaPy(username, password)
session.login()
session.set_relationship_bounds(enabled=True,max_followers=200)
session.set_do_follow(True,percentage=100)
session.like_by_tags(["indiemusic", "heartbreakanniversary"], amount=5,interact=True)
session.set_dont_like(["naked", "nsfw"])
session.set_do_follow(True, percentage=50)
session.set_do_comment(True, percentage=50)
session.set_comments(["Nice!", "S`weet!", "Beautiful :heart_eyes:"])
session.set_user_interact(amount=1,randomize=True,percentage=100)
session.end()
Run Code Online (Sandbox Code Playgroud) 我正在阅读 Cracking the Coding Interview 并做练习题,但我一直坚持这个问题:
“实现一种算法来查找单向链表的第 k 个到最后一个元素。”
我的递归函数没有返回任何东西,我不知道为什么。在递归函数中,我采用了 3 个参数。K
将是我们想要找出的最后一个元素的位置。Node* temp
将是头节点, int i 将保留最后一个节点的元素计数。
#include<bits/stdc++.h>
using namespace std;
class Node
{
int data;
Node* next;
public:
Node(){
data=0;
next=NULL;
}
friend class LinkedList;
};
class LinkedList
{
public:
Node* head;
public:
LinkedList(){
head=NULL;
}
void append(int data){
Node* temp= new Node();
temp->data=data;
temp->next=NULL;
if (head==NULL){
head=temp;
}
else{
Node* ptr=head;
while(ptr->next!=NULL){
ptr=ptr->next;
}
ptr->next=temp;
}
}
void display(){
Node* ptr=head;
if(head==NULL){
cout<<"List is empty"<<endl; …
Run Code Online (Sandbox Code Playgroud)