![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
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 · 152 阅读 · 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: 2Example 2:In...原创 2018-11-16 06:00:50 · 131 阅读 · 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 · 185 阅读 · 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 · 107 阅读 · 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->4Output: 1->...原创 2018-11-13 19:50:56 · 150 阅读 · 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 · 135 阅读 · 0 评论 -
13. Roman to Integer(python3)
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...原创 2018-11-13 07:42:50 · 335 阅读 · 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: 121Output: trueExample 2:Input: -121Output: falseExplanation...原创 2018-11-05 08:43:23 · 371 阅读 · 0 评论 -
7. Reverse Integer (python3)
Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dealing with an ...原创 2018-11-05 08:30:47 · 346 阅读 · 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 · 314 阅读 · 0 评论 -
38. Count and Say (python 3)
The count-and-say sequence is the sequence of integers with the first five terms as following:1112112111112211 is read off as “one 1” or 11.11 is read off as “two 1s” or 21.21...原创 2018-11-16 06:56:40 · 235 阅读 · 0 评论