Python刷题提升解析
文章平均质量分 79
造化天运
同志,这是我传给你的代码,请收好
展开
-
Python刷题提升解析:第一季
本文所述的题目来自于题目出处,作者为:Python程序员本文只针对题目进行答案解析,题目的著作权由原作者享有。第一题:从键盘中输入两个数a,b,求他们的四则运算结果,要求保留两位小数。题目分析:该题目要求我们需要掌握input函数的用法,以及四则运算的判定实施,并且掌握对浮点数的打印显式规则。由于该题目在描述上还是比较模糊,因此我选择了由用户直接键入四则运算表达式,然后程序处理后给出结果,这样不仅...原创 2018-05-09 15:24:02 · 2556 阅读 · 1 评论 -
Python刷题:简单数组(三)
11.Best Time to Buy and sellStockⅡ Say you have an array for which the ithelement is the price of a given stock on day i. Design an algorithm to find the maximum profit.You may complete as many ...原创 2018-07-16 10:37:28 · 861 阅读 · 0 评论 -
Python刷题:简单数组(一)
这是一个简单的说明性帖子,题目是它挑选的。1.Two Sum Given an array of integers, return indicesof the two numbers such that they add up to a specific target. You may assumethat each input would have exactly one solution...原创 2018-06-30 15:54:35 · 1373 阅读 · 1 评论 -
Python刷题:简单数组(二)
6. Plus One Given a non-negative integer represented asa non-empty array of digits, plus one to the integer. You may assume theinteger do not contain any leading zero, except the number 0 itself. T...原创 2018-07-03 21:50:26 · 604 阅读 · 0 评论 -
Python刷题:简单数组(四)
16.Contains DuplicateⅡ Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference be...原创 2018-07-19 09:32:20 · 799 阅读 · 0 评论 -
Python刷题:简单数组(五)
21.Max Consecutive Ones Given a binary array, find the maximum number of consecutive 1s in this array. 给定一个二进制数组,找出由该数组中连续出现的数字一的最大个数。 示例:nums=[1,1,0,1,1,1],输出3 程序: def fm(nums): curren...原创 2018-07-19 09:37:13 · 1871 阅读 · 0 评论 -
Python刷题:哈希表(一)
1.Single Number Given an array of integers, every element appears twice except for one. Find that single one. You algorithm should have a liner runtime complexity. Could you implement it without ...原创 2018-08-01 22:33:37 · 932 阅读 · 0 评论 -
Python刷题:哈希表(二)
6.Word Pattern Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-em...原创 2018-08-01 22:37:17 · 386 阅读 · 0 评论 -
Python刷题:哈希表(三)
11.Find All Anagrams in a String Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s. Strings consists of lowercase English letters only and the length of b...原创 2018-08-01 22:41:00 · 1742 阅读 · 0 评论