摘要:
Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level). Example1: Input: r 阅读全文
摘要:
Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the sa 阅读全文
摘要:
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example 1: Input: root = [1,2,2,3,4,4,3] 阅读全文
摘要:
Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they a 阅读全文
摘要:
You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list 阅读全文
摘要:
模板模式(Template Method Pattern) Define the skeleton of an algorithm in operations, deferring some steps to subclasses. Template Method lets subclasses r 阅读全文
摘要:
抽象工厂模式(Abstract Factory Pattern) Provide an interface for creating families of related or dependent objects without specifying their concerete classes 阅读全文
摘要:
工厂模式 Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation 阅读全文
摘要:
单例模式(Singleton Pattern) Ensure a class has only one instance, and provide a global point of access to it.(确保只有一个实例, 而且自行实例化并向整个系统提供这个实例。) 模板 通用代码 publ 阅读全文
摘要:
六大原则 单一职责原则: There should be no more than one reason for a class to change 最佳实践: 接口的设计一定要做到单一职责,类的设计尽量做到只有一个原因引起变化。 里氏替换原则: Functions that use pointer 阅读全文