
leetcode
hang1027
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
771. Jewels and Stones(python3)
一刷leetcode,做个记录 使用python的string的内建函数:str.count(sub, start= 0,end=len(string)) sub – 搜索的子字符串 start – 字符串开始搜索的位置。默认为第一个字符,第一个字符索引值为0。 end – 字符串中结束搜索的位置。字符中第一个字符的索引为 0。默认为字符串的最后一个位置。 class Solution: ...原创 2018-11-05 07:25:50 · 208 阅读 · 0 评论 -
28. Implement strStr() (python 3)
Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: haystack = “hello”, needle = “ll” Output: 2 Example 2: In...原创 2018-11-16 06:00:50 · 184 阅读 · 0 评论 -
66. Plus One (python 3)
Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significant digit is at the head of the list, and each element ...原创 2018-11-14 08:15:33 · 241 阅读 · 0 评论 -
88. Merge Sorted Array (python 3)
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and nums2 are m and n respectively. You may assume that n...原创 2018-11-13 20:02:45 · 143 阅读 · 0 评论 -
21. Merge Two Sorted Lists (python 3)
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->4 Output: 1->...原创 2018-11-13 19:50:56 · 193 阅读 · 0 评论 -
14. Longest Common Prefix (python 3)
Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”. Example 1: Input: [“flower”,“flow”,“flight”] Output: “fl...原创 2018-11-13 08:06:09 · 193 阅读 · 0 评论 -
13. Roman to Integer(python3)
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D ...原创 2018-11-13 07:42:50 · 392 阅读 · 0 评论 -
9. Palindrome Number(python3)
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation...原创 2018-11-05 08:43:23 · 438 阅读 · 0 评论 -
7. Reverse Integer (python3)
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing with an ...原创 2018-11-05 08:30:47 · 414 阅读 · 0 评论 -
1. Two Sum(python3)
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same e...原创 2018-11-05 07:41:26 · 392 阅读 · 0 评论 -
38. Count and Say (python 3)
The count-and-say sequence is the sequence of integers with the first five terms as following: 1 11 21 1211 111221 1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21. 21...原创 2018-11-16 06:56:40 · 304 阅读 · 0 评论