上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要: 1、字符串分割 2、类型转换 stringstream类型转换的时候,一直读到第一个不符合类型的字符为止。 demo:利用stringstream实现字符串数字计算 阅读全文
posted @ 2018-05-09 18:09 Zzz...y 阅读(818) 评论(0) 推荐(0) 编辑
摘要: Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. 字符串相乘。 解决: 1、 阅读全文
posted @ 2018-05-08 18:00 Zzz...y 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1、递归遍历 把3~5行按照访问顺序交换一下位置,就能实现前序遍历、中序遍历和后序遍历。 2、非递归遍历 非递归遍历可以用栈实现。 a. 前序遍历(144. Binary Tree Preorder Traversal) 前序遍历节点访问次序是 根-左-右 所以对于弹出的每一个节点,进栈顺序是先右孩 阅读全文
posted @ 2018-05-08 13:34 Zzz...y 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib 阅读全文
posted @ 2018-04-26 13:45 Zzz...y 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime com 阅读全文
posted @ 2018-04-25 12:29 Zzz...y 阅读(539) 评论(0) 推荐(0) 编辑
摘要: 父进程创建两个子进程,子进程通过管道向父进程传递消息。父进程先读子进程1的,再读子进程2的。 发送信号告诉两个子进程向管道写数据,等到子进程结束,再从管道读取。 把L52,L53分别和L58,L59互换,就实现了先读进程1,再读进程2。 阅读全文
posted @ 2018-04-24 19:35 Zzz...y 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 调用fork()创建两个子进程,父进程接受SIGINT信号中断,之后发送16和17中断子进程。 运行后打开另一个终端,用ps aux获取进程pid号 向父进程发送SIGINT中断信号。 结果: 阅读全文
posted @ 2018-04-24 12:30 Zzz...y 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. 翻转指定范围内的节点。 解决:用一个i记录当前是第几号节点。 阅读全文
posted @ 2018-04-23 11:38 Zzz...y 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2018-04-11 19:28 Zzz...y 阅读(123) 评论(0) 推荐(0) 编辑
摘要: We are given the head node root of a binary tree, where additionally every node's value is either a 0 or a 1. Return the same tree where every subtree 阅读全文
posted @ 2018-04-09 13:57 Zzz...y 阅读(149) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页