摘要: 题目链接 "https://leetcode.com/problems/text justification/" 题目原文 Given an array of words and a length L, format the text such that each line has exa... 阅读全文
posted @ 2016-01-12 17:10 slurm 阅读(486) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode.com/problems/add-binary/题目大意:给定两个二进制字符串,返回它们的和解题思路:模拟二进制竖式加法class Solution(object): def addBinary(self, a, b): """ ... 阅读全文
posted @ 2016-01-12 16:08 slurm 阅读(245) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode.com/problems/plus-one/题目大意:用一个digit数组表示一个非负整数,加1后返回这个数组 例如:[9,9]加1返回[1,0,0]解题思路:从后往前遍历,一次判断进位即可;注意计算到最高位的时候是否有进位的处理class Solu... 阅读全文
posted @ 2016-01-12 15:50 slurm 阅读(273) 评论(0) 推荐(0)