- 博客(13)
- 资源 (3)
- 收藏
- 关注
原创 程序员的算法趣题 python3 - (2)
注:以下题目来自《程序员的算法趣题》– [日]增井敏克著,原书解法主要用Ruby实现,最近在学Python,随便找点东西写写当做练习,准备改成Python3实现,顺便增加一些自己的理解。6.考拉兹猜想考拉兹猜想: 对自然数n: 若n为偶数,n /= 2 若n为奇数,n = n*3 + 1 循环操作,无论初始值为多少,最终得到1(1->4->2->1循环) 修改:...
2018-05-28 23:56:41 811
原创 leetcode practice - python3 (10)
198. House RobberDescriptionHintsSubmissionsDiscussSolution You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constrain...
2018-05-28 23:36:46 293
原创 程序员的算法趣题 python3 - (1)
1.回文数求十进制、二进制、八进制表示都是回文数的数字中,大于十进制数10的最小值。num = 11while True: s10 = str(num) s2 = str(bin(num))[2:] s8 = str(oct(num))[2:] if s10 == s10[::-1] and s2 == s2[::-1] and s8 == s8[::...
2018-05-27 01:11:58 893
原创 leetcode practice - python3 (9)
617. Merge Two Binary TreesDescriptionHintsSubmissionsDiscussSolution Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped...
2018-05-26 15:31:19 225
原创 leetcode practice - python3 (8)
169. Majority ElementDescriptionHintsSubmissionsDiscussSolution Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You m...
2018-05-26 15:14:26 385
原创 leetcode practice - python3 (7)
543. Diameter of Binary TreeDescriptionHintsSubmissionsDiscussSolution Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length o...
2018-05-26 14:57:55 277
原创 leetcode practice - python3 (6)
56. Merge IntervalsDescriptionHintsSubmissionsDiscussSolution Given a collection of intervals, merge all overlapping intervals.Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,1...
2018-05-26 14:33:59 234
原创 leetcode practice - python3 (5)
98. Validate Binary Search TreeDescriptionHintsSubmissionsDiscussSolution Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left su...
2018-05-26 14:15:20 311
原创 leetcode practice - python3 (4)
78. SubsetsDescriptionHintsSubmissionsDiscussSolution Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets...
2018-05-20 20:01:40 213
原创 leetcode practice - python3 (3)
53. Maximum SubarrayDescriptionHintsSubmissionsDiscussSolution Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its su...
2018-05-16 19:34:49 168
原创 leetcode practice - python3 (2)
21. Merge Two Sorted ListsDescriptionHintsSubmissionsDiscussSolution Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the fir...
2018-05-15 19:05:43 198
原创 leetcode practice - python3 (1)
1. Two SumGiven an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not u...
2018-05-13 14:18:18 265
原创 babyos2(43) network(9) -- tcp, sock_stream
前面给babyos实现了简单的UDP,这次准备实现一个非常简单的TCP协议。TCP提供一种面向连接的、可靠的字节流服务。在一个TCP连接中,仅有两方进行彼此通信。 TCP通过下列方式来提供可靠性: • 应用数据被分割成 TCP认为最适合发送的数据块。这和 UDP完全不同,应用程序产生的数据报长度将保持不变。由 TCP传递给IP的信息单位称为报文段或段( segment); • 当TCP发...
2018-05-06 23:27:34 448 2
Qt 真三装备连连看
2012-12-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人