- 博客(2)
- 收藏
- 关注
原创 LeetCode Swap Nodes in Pairs题目的一种简洁解法
这题目比较简单,看了很多结题方法都是新建链表,但也可以使用递归方法,代码量非常少。 class Solution { public: ListNode* swapPairs(ListNode* head) { if((head==NULL)||(head->next==NULL))//递归结束条件 return head;
2017-01-18 21:57:56
102
原创 随意大小的菱形打印c程序(Windows可运行),水平太差,无线for循环
#include void diamind(int x, char y) { int i, j, k, l, m; if (x % 2 == 0) printf("error"); else{ for (i = 1; i { for (j = 1; j { if ((j = (x + (2 * i + 1)) / 2)) { if (j == x) printf(
2016-09-12 10:16:12
133
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人