102
来源:互联网 发布:国密sm2算法程序 编辑:程序博客网 时间:2024/04/29 16:29
5.26
好久没写代码了。今天就瞎写几道简单的吧。链表还是比较容易的呢。
/** * Definition for ListNode. * public class ListNode { * int val; * ListNode next; * ListNode(int val) { * this.val = val; * this.next = null; * } * } */ public class Solution { /** * @param head: The first node of linked list. * @return: True if it has a cycle, or false */ public boolean hasCycle(ListNode head) { // write your code here HashMap<ListNode,Integer> map = new HashMap<ListNode,Integer>(); while(head != null){ if(!map.containsKey(head)){ map.put(head,1); } else{ return true; } head = head.next; } return false; }}
阅读全文
0 0
- 102
- 102
- 102
- 102
- UVA 102
- 102、Makefile
- nyoj-102
- nyist-102
- SGU 102
- sgu100~102
- ocp-102
- lasrevarTredrOlevlLeerTyraniB.102
- PHPMaker V2.102
- Truth (Episode 102)
- SQLServer技术(102)
- Friends ---102笔记
- reactos操作系统实现(102)
- 102 - Ecological Bin Packing
- IE8下jQuery改变png图片透明度时出现的黑边问题
- 使用Html5下WebSocket搭建简易聊天室
- (4)puppet常用的资源及其常用属性
- 进程的内存占用情况
- Tomcat服务器部署(包含JDK安装)
- 102
- Java面向对象,基本类型包装类
- 获取UIWebView的内容高度(精准)
- img图片底部出现莫名的下边距问题
- 虚拟机VMware+Ubuntu系统的安装教程
- Linux网络编程(一)——消灭僵尸进程
- excel自动求和,替换空值
- SQL中的case when then else end用法
- python 中 print 函数用法总结