- 博客(12)
- 资源 (1)
- 收藏
- 关注
转载 Python基础算法/剑指offer
https://blog.youkuaiyun.com/u012505432/article/details/52071537
2018-11-19 01:03:30
181
原创 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
287
原创 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
167
原创 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
224
原创 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
133
原创 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
185
原创 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
174
原创 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
373
原创 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
408
原创 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
394
原创 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
369
原创 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
190
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人