Kotlin提供了几个作用域函数来优化和简化代码的结构。
本文将对比分析 apply, let, 和 with 三个函数。
一、对比分析:
apply:在其接收者的上下文中执行代码块,并返回接收者对象。let:在其接收者的上下文中执行代码块ÿ…
添加链接描述 我的题解:
class Solution:def maxArea(self, height: List[int]) -> int:# 两层for循环,保存最大值temp0res0for i in range(len(height)-1):for j in range(i1,len(height)):tempmin(height[i],height[j])*(j-i)# print(temp)resmax…