Xianng's Blog

To be a better man!


  • Home

  • Tags

  • Categories

  • Archives

Median of Two Sorted Arrays

Posted on 2018-09-06 |

Median of Two Sorted Arrays

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 should be O(log (m+n)).

You may assume nums1 and nums2 cannot be both empty.

Example 1:

nums1 = [1, 3]
nums2 = [2]

The median is 2.0

Example 2:

nums1 = [1, 2]
nums2 = [3, 4]

The median is (2 + 3)/2 = 2.5
Read more »

Shadowsocks安装及多用户配置

Posted on 2018-08-24 |

安装Shadowsocks服务

Debian / Ubuntu:

apt-get install python-pip
pip install git+https://github.com/shadowsocks/shadowsocks.git@master

CentOS:

yum install python-setuptools && easy_install pip
pip install git+https://github.com/shadowsocks/shadowsocks.git@master

Windows:

See Install Shadowsocks Server on Windows.

Read more »

机器学习的一些资料

Posted on 2017-08-19 |
Machine-Learning.jpg

昨天找了很多资料,终于也差不多确定了的学习轨迹。
具体计划如下:

Read more »

Longest Palindromic Substring

Posted on 2017-08-15 |

最早考虑的是遍历一遍字符串,以每个元素为middle,再向左向右判断元素是否相等,
同时还需要考虑中心元素为1个,还是2个两种情况。最终导致,效率低下,提交时最后一个test没有通过。

输入:“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”,这样就会执行n*(1+2+…n/2) = O(n^3)

从网上搜索后,找到几个常见的方法

Read more »
xianng

xianng

4 posts
8 tags
GitHub E-Mail
© 2017 — 2018 xianng
Powered by Hexo
|
Theme — NexT.Gemini v5.1.4