摘要:
本篇主干内容是TCP/IP网络编程1-9章学习笔记 1. linux文件描述符 描述符从3开始以由小到大的顺序编号,0,1,2,分配给标准I/O用作标准输入、标准输出和标准错误。 2. 协议族与套接字类型(socket函数第一、二个参数) domain常用 : IPv4协议族 PF_INET; ty 阅读全文
摘要:
题目: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order r 阅读全文
摘要:
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文
摘要:
题目: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.(Medium) 分析: 题意很简单,就是把为0的元素所在的行和列都置0; 首先不能直接边循环边做,这样会 阅读全文
摘要:
leetcode现在每周末举办比赛,这是今天上午参加的比赛的题解。题目难度不算大,两个easy,一个medium,一个hard。hard题之前接触过,所以做得比较顺利。 1. Sum of Left Leaves(Leetcode 404 Easy) Find the sum of all left 阅读全文
摘要:
题目: Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You h 阅读全文
摘要:
题目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can yo 阅读全文
摘要:
题目: Given two binary strings, return their sum (also a binary string). (Easy) For example,a = "11"b = "1"Return "100". 分析: 思路很简单,就是按位依次相加,处理进位即可,循环条件里 阅读全文
摘要:
题目: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequ 阅读全文
摘要:
题意: Implement int sqrt(int x). Compute and return the square root of x.(Medium) 分析: 二分搜索套路题,不能开方开尽的时候,取结果整数位。 注意:判定条件中,用x / mid == mid而不是 mid * mid == 阅读全文