摘要: 一 工厂模式介绍 1.1 工厂模式的定义 先来看下GOF为工厂模式的定义: “Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Metho 阅读全文
posted @ 2019-02-27 20:16 Roni_i 阅读(147) 评论(0) 推荐(0)
摘要: 一、单例模式介绍 1.1 定义 保证一个类仅有一个实例,并提供一个访问它的全局访问点。 1.2 为什么要用单例模式? 在我们的系统中,有一些对象其实我们只需要一个,比如说:线程池、缓存、对话框、注册表、日志对象、充当打印机、显卡等设备驱动程序的对象。事实上,这一类对象只能有一个实例,如果制造出多个实 阅读全文
posted @ 2019-02-27 17:55 Roni_i 阅读(171) 评论(0) 推荐(0)
摘要: Given a linked list, remove the n-th node from the end of list and return its head. Example: Note: Given n will always be valid. Follow up: Could you 阅读全文
posted @ 2019-02-27 15:16 Roni_i 阅读(133) 评论(0) 推荐(0)
摘要: Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middl 阅读全文
posted @ 2019-02-27 15:08 Roni_i 阅读(104) 评论(0) 推荐(0)
摘要: You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文
posted @ 2019-02-27 14:50 Roni_i 阅读(184) 评论(0) 推荐(0)
摘要: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2019-02-27 13:41 Roni_i 阅读(148) 评论(0) 推荐(0)
摘要: Remove all elements from a linked list of integers that have value val. Example: 【递归】 阅读全文
posted @ 2019-02-27 13:09 Roni_i 阅读(195) 评论(0) 推荐(0)
摘要: Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: Follow up:Could you do it in O(n) time and O(1) space? 阅读全文
posted @ 2019-02-27 12:39 Roni_i 阅读(100) 评论(0) 推荐(0)