[LeetCode]Largest Palindrome Product

题目描述:

LeetCode 479. Largest Palindrome Product

Find the largest palindrome made from the product of two n-digit numbers.

Since the result could be very large, you should return the largest palindrome mod 1337.

Example:

Input: 2

Output: 987

Explanation: 99 ...

继续阅读

Python Requests实现短网址还原

利用python-requests(http://www.python-requests.org/),只需数行代码即可实现短网址还原。

通过HTTP HEAD请求,从返回响应的头信息(headers)中取出Location字段即为短网址对应的原始网址。

Python代码:

import requests
def revertShortLink(url):
    res = requests.head(url)
    return res.headers.get('location')

代码测试:

print revertShortLink('http://t.cn/RVMAn7W')

返回结果:

http://bookshadow.com/weblog/2016/10 ...

继续阅读

LeetCode Weekly Contest 13解题报告

LeetCode Weekly Contest 13是LeetCode举办的第十六场正式周赛,共4道题目,比赛时长2小时。

比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-13/

题解列表:

LeetCode 461. Hamming Distance

LeetCode 477. Total Hamming Distance

LeetCode 473. Matchsticks to Square

LeetCode 472. Concatenated Words

年度归档