- 博客(12)
- 资源 (1)
- 收藏
- 关注
转载 Python基础算法/剑指offer
https://blog.csdn.net/u012505432/article/details/52071537
2018-11-19 01:03:30
200
原创 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
原创 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
原创 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
原创 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
原创 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
原创 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
原创 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
391
原创 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
原创 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
原创 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
原创 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
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人