摘要: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font 阅读全文
posted @ 2017-10-25 15:58 cp_cnblogs 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "b 阅读全文
posted @ 2017-10-25 01:01 cp_cnblogs 阅读(136) 评论(0) 推荐(0) 编辑
摘要: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文
posted @ 2017-10-24 23:35 cp_cnblogs 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng 阅读全文
posted @ 2017-10-24 16:37 cp_cnblogs 阅读(117) 评论(0) 推荐(0) 编辑
摘要: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai 阅读全文
posted @ 2017-10-24 15:56 cp_cnblogs 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Given 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 ex 阅读全文
posted @ 2017-10-24 15:41 cp_cnblogs 阅读(116) 评论(0) 推荐(0) 编辑
摘要: (一)请简述TCP\UDP的区别 TCP和UDP是OSI模型中的运输层中的协议。TCP提供可靠的通信传输,而UDP则常被用于让广播和细节控制交给应用的通信传输。 两者的区别大致如下: TCP面向连接,UDP面向非连接即发送数据前不需要建立链接 TCP提供可靠的服务(数据传输),UDP无法保证 TCP 阅读全文
posted @ 2017-08-22 11:42 cp_cnblogs 阅读(291) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.com/problems/hamming-distance/?tab=Description 两个数字之间的汉明距离就是两个数二进制位对应位不同的个数 按位分别取出两个数对应位的数异或,异或的性质是相同为0, 不同为1,我们把1的情况累加起来就是汉明距离。 阅读全文
posted @ 2017-02-26 12:54 cp_cnblogs 阅读(167) 评论(0) 推荐(0) 编辑
摘要: hello world 阅读全文
posted @ 2016-10-19 08:32 cp_cnblogs 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 二分搜索算法上运用分治策略的典型例子。 给定已排好序的n个元素a[0...n-1],现在要在这n个元素中找出一特定元素x。 首先想到的是用顺序搜索方法,逐个比较a[0...n-1]中元素,直至找出元素x或搜索整个数组后确定x不在其中。这个算法没有很好利用n个元素已排好序这个条件,因此在最坏情况下,顺 阅读全文
posted @ 2016-05-10 22:52 cp_cnblogs 阅读(829) 评论(0) 推荐(0) 编辑