# LRU 缓存的魔力

## 解决方案

$$T = m * T_m + T_h + E$$

T = 平均内存引用时间

[TOC]

[Chinese ver]

# LeetCode 7. Reverse Integer

[English ver]Easy

# 7. Reverse Integer

Reverse digits of an integer.

Example1: x = 123, return 321
Example2: x = -123, return -321

Note:
The input is assumed to be a 32-bit signed integer. Your function should return 0 when the reversed integer overflows.

[Chinese ver]

# 6. ZigZag Conversion

convert(“PAYPALISHIRING”, 3) 应该返回 “PAHNAPLSIIGYIR”.

[English ver]

# 6. ZigZag Conversion

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 for better legibility)

And then read line by line: “PAHNAPLSIIGYIR”
Write the code that will take a string and make this conversion given a number of rows:

convert(“PAYPALISHIRING”, 3) should return “PAHNAPLSIIGYIR”.

# 5. Longest Palindromic Substring

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

Note: “aba” is also a valid answer.

Example:

I have misunderstood the meaning of the word palindrome , i thought it was the meaning of repeat,finally i know that it was the meaning of a string which is the same when you look from left to right and from right to left.
According to that , we know it has two situation,one the length is odd , another is even .

# 5. Longest Palindromic Substring

Example:

Note: “aba” is also a valid answer.

Example:

[English ver]

# 4. 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)).

[Chinese ver]