QQ空间->仅对你可见

效果图

效果图

实现要求:

QQ有黄砖

步骤:

一:

一

二:

二

三:

三

具体代码:
[em]e10011[/em]仅对你可见
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
以下是用C语言实现调整单链表的函数,使得k个结点之间逆序,时间复杂度为O(N): ``` #include <stdio.h> #include <stdlib.h> typedef struct ListNode { int val; struct ListNode *next; } ListNode; ListNode* reverseKGroup(ListNode* head, int k) { if (head == NULL || k == 1) { return head; } ListNode *dummy = (ListNode *)malloc(sizeof(ListNode)); dummy->next = head; ListNode *pre = dummy, *cur = head; int len = 0; while (cur != NULL) { len++; cur = cur->next; } while (len >= k) { cur = pre->next; for (int i = 1; i < k; i++) { ListNode *next = cur->next; cur->next = next->next; next->next = pre->next; pre->next = next; } pre = cur; len -= k; } return dummy->next; } int main() { ListNode *head = (ListNode *)malloc(sizeof(ListNode)); head->val = 1; head->next = (ListNode *)malloc(sizeof(ListNode)); head->next->val = 2; head->next->next = (ListNode *)malloc(sizeof(ListNode)); head->next->next->val = 3; head->next->next->next = (ListNode *)malloc(sizeof(ListNode)); head->next->next->next->val = 4; head->next->next->next->next = (ListNode *)malloc(sizeof(ListNode)); head->next->next->next->next->val = 5; head->next->next->next->next->next = (ListNode *)malloc(sizeof(ListNode)); head->next->next->next->next->next->val = 6; head->next->next->next->next->next->next = (ListNode *)malloc(sizeof(ListNode)); head->next->next->next->next->next->next->val = 7; head->next->next->next->next->next->next->next = (ListNode *)malloc(sizeof(ListNode)); head->next->next->next->next->next->next->next->val = 8; head->next->next->next->next->next->next->next->next = NULL; int k = 3; ListNode *newHead = reverseKGroup(head, k); while (newHead != NULL) { printf("%d->", newHead->val); newHead = newHead->next; } printf("null\n"); return 0; } ``` 关于第二个问题,"lua closure factory 完整代码",以下是一个简单的Lua闭包工厂的完整代码: ``` function createClosure(x) return function(y) return x + y end end closure1 = createClosure(1) closure2 = createClosure(2) print(closure1(2)) -- 输出3 print(closure2(3)) -- 输出5 ``` 第三个问题,"中文加密",这个问题比较宽泛,不知道你具体想问什么。如果你想了解中文加密的一些常见方法,可以参考以下链接: https://zh.wikipedia.org/wiki/%E4%B8%AD%E6%96%87%E5%8A%A0%E5%AF%86 https://blog.csdn.net/qq_35644234/article/details/60870728 https://www.cnblogs.com/zhengyun_ustc/p/10556394.html

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值