Python
共 2 篇文章
洛谷-P8218 【深进1.例1】求区间和
题目链接: 求区间和 如果就按题意,我们简单的想的话,那就是这个题读取完数据,然后再读区间,确定起始索引和终止索引.然后用for循环对这个区间求和就可以了. python代码如下: import sys input = lambda: sys.stdin.readline().strip() n
leetcode-1.两数之和
题目链接: 两数之和 这个题我们可以简单的想到暴力枚举的方案,让所有的数字两两组合,如果等于目标值.就返回对应的索引. python代码如下: class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: