摘要: 1 """ 2 Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. 3 Sort the array so that when 阅读全文
posted @ 2020-02-06 21:45 yawenw 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 1 """ 2 Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. 3 Example 1: 4 Input: "bab 阅读全文
posted @ 2020-02-06 15:29 yawenw 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 1 """ 2 Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. 3 A mapping of d 阅读全文
posted @ 2020-02-06 15:26 yawenw 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 """ 2 先用dict存储罗马数字对应的阿拉伯数字, 3 IV可划分为I,V,比较相邻字符的大小进行加减操作 4 """ 5 class Solution: 6 def romanToInt(self, s): 7 if s == None: #讨论边界情况 8 return 0 9 sum 阅读全文
posted @ 2020-02-05 21:51 yawenw 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 1 """ 2 Write a function to find the longest common prefix string amongst an array of strings. 3 If there is no common prefix, return an empty string 阅读全文
posted @ 2020-02-05 21:49 yawenw 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1 """ 2 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. 3 An input string is va 阅读全文
posted @ 2020-02-05 21:42 yawenw 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 1 """ 2 Given a string s and a string t, check if s is subsequence of t. 3 You may assume that there is only lower case English letters in both s and 阅读全文
posted @ 2020-02-05 10:06 yawenw 阅读(120) 评论(0) 推荐(0) 编辑
摘要: """ Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transac 阅读全文
posted @ 2020-02-04 22:07 yawenw 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 1 """ 2 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint sto 阅读全文
posted @ 2020-02-04 22:05 yawenw 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 1 """ 2 On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). 3 Once you pay the cost, you can either climb one or tw 阅读全文
posted @ 2020-02-04 22:03 yawenw 阅读(131) 评论(0) 推荐(0) 编辑