0%

Description

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.

Example1:

1
2
3
Input: "babad"
Output: "bab"
Note: "aba" is also a valid answer.

Example2:

1
2
Input: "cbbd"
Output: "bb"

Read more »

你是否拥有这样的问题: - python版本需求不同,有时需要2.7,有时需要3.5,有时需要3.7 - 不同项目python需要的版本不同,这个需要3.5,那个需要3.7,还有一个需要2.7 - python版本装多了以后管理混乱,例如pip 的使用,不知道将库具体安装到哪一个版本,python 解释环境也搞不清,完全是碰运气 - python 可能安装了很多外部库,但是此项目只用到了一两个甚至没有用到,感觉很浪费 - 使用python 开发项目时,安装了很多外部库,随着项目开发的越来越多,python 安装的外部库越来越多,到这python 很臃肿 - 不同项目使用的外部库版本不同,导致在切换项目是要先删除之前的外部库,安装这个项目需要的外部库版本 - 现在几乎所有的操作系统都自带python,但大多数都是python2 版本,许多系统组件与其挂钩,不能轻易更改或者删除

所以,我们需要python 版本控制,就引出了本篇博文主题—— pyenv 以及pyenv-virtualenv

Read more »

Description

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.

Example1:

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

The median is 2.0

Example2:

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

The median is (2 + 3)/2 = 2.5

Read more »

Description

Given a string, find the length of the longest substring without repeating characters.

Example1:

1
2
3
Input: "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.

Example2:

1
2
3
Input: "bbbbb"
Output: 1
Explanation: The answer is "b", with the length of 1.

Example3:

1
2
3
4
Input: "pwwkew"
Output: 3
Explanation: The answer is "wke", with the length of 3.
Note that the answer must be a substring, "pwke" is a subsequence and not a substring.

Read more »