dmndxld

码不停题

2019年5月6日

167. Two Sum II - Input array is sorted

摘要: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文

posted @ 2019-05-06 22:00 imyourterminal 阅读(108) 评论(0) 推荐(0) 编辑

561. Array Partition I

摘要: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文

posted @ 2019-05-06 20:52 imyourterminal 阅读(110) 评论(0) 推荐(0) 编辑

344. Reverse String

摘要: Question: Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another 阅读全文

posted @ 2019-05-06 20:27 imyourterminal 阅读(164) 评论(0) 推荐(0) 编辑

14. 最长公共前缀

摘要: 题目: 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 示例 1: 说明: 所有输入只包含小写字母 a-z 。 思路:既然给我的是字符串数组,那我要比较的就不是两个元素了,所以考虑把这些元素的元素都一个一个取出来,放进空字符串里面,然后用字符串的count方 阅读全文

posted @ 2019-05-06 11:59 imyourterminal 阅读(136) 评论(0) 推荐(0) 编辑

实现strStr()

摘要: 题目:给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 -1。 示例: 说明: 当 needle 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。 对于本题而言, 阅读全文

posted @ 2019-05-06 10:59 imyourterminal 阅读(298) 评论(0) 推荐(0) 编辑

二进制求和

摘要: 题目: 给定两个二进制字符串,返回他们的和(用二进制表示)。 输入为非空字符串且只包含数字 1 和 0。 示例 1: 思路:我反正佛了我自己的思路。。先把字符串转列表,然后加0对其,因为我不会从高位加所以就颠倒相加得结果,结果是列表,再颠倒转字符串就行了。。。。我去。。这个不熟python可真难受 阅读全文

posted @ 2019-05-06 01:14 imyourterminal 阅读(318) 评论(0) 推荐(0) 编辑

导航