1、Find the last element of a list.
来源:互联网 发布:苏州市那美网络 编辑:程序博客网 时间:2024/05/17 22:50
Example:
scala> last(List(1, 1, 2, 3, 5, 8))res0: Int = 8
最直接的办法
def s1(list:List[Any])={ list.last}def main(args: Array[String]) { println(s1(List(1,2,3,4,5)))}
0 0
- 1、Find the last element of a list.
- Find the nth to last element of a singly linked list
- [CrackCode] 2.2 Find the nth to last element of a singly linked list
- Q2.2 Find the kth to last element of a singly linked list
- To find the kth to Last Element of a Singly Linked List
- 【10】Find nth to last element of a singly linked list
- 1007. Find the middle element in a Linked List
- find the kth largest element in a list and find the first k largest elements in a list
- Ch2-2: return the nth to the last node data of a singly linked list
- The last Node of Link List
- cvc-elt.1: Cannot find the declaration of element 'ehcache'.
- cvc-elt.1: Cannot find the declaration of element 'beans'.
- cvc-elt.1: Cannot find the declaration of element 'MyElement'
- cvc-elt.1: Cannot find the declaration of element 'beans'.
- cvc-elt.1: Cannot find the declaration of element 'beans'
- give two sorted array, find the k-th smallest element of union of A and B
- Cannot find the declaration of element 'beans'
- Cannot find the declaration of element 'beans'
- Vagrant中搭建Docker虚拟环境(上)-Mac
- 查看oracle当前连接数(转)
- 任务管理器的实现及源码
- spring管理属性配置文件properties——使用PropertyPlaceholderConfigurer
- 线程池ThreadPoolExecutor使用简介
- 1、Find the last element of a list.
- 关于JAVA 类加载器的研究
- PAT(甲级)1026
- Mac技术预览之<1>关于为Mac开发应用
- 白话经典算法系列之九 从归并排序到数列的逆序数对(微软笔试题)
- 进入实战,开发酷欧天气(四)
- index invisible与unusable 特性
- Android.mk写法
- 1045. 快速排序(25)