wangyw Blog

Constant dropping wears the stone

Spring AOP

Spring AOP(前置通知&后置通知) 前置通知 配置 加入jar包 aopalliance-1.0.0.jar aspectj.weaver-1.8.0.jar spring-aop-4.1.5.RELEASE.jar spring-aspects-4.1.5.RELEASE.jar commons.log...

Maximum Product of Word Lengths

单词长度的最大积

318. Maximum Product of Word Lengths[译] 题意 Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume ...

IOC 容器中Bean的生命周期

IOC 容器中Bean的生命周期 Spring IOC 容器可以管理Bean的生命周期 Spring允许在Bean生命周期的特定执行点知性定制的任务 Spring容器对Bean的生命周期进行管理的过程: 通过构造器或工厂方法创建Bean实例 为Bean的属性设置值和对其他Bean的引用 调用Bean的初始化方法 Bean可以使用 当容器关闭时,调用Bea...

最大子序列&最长公共子串&最长公共子序列

1、最大子序列和 题意 最大子序列和是要找出由数组成的一维数组中和最大的连续子序列。 例如 [www.baidu.com] {5,-3,4,2}的最大子序列就是 {5,-3,4,2},它的和是8,达到最大;而 {5,-6,4,2}的最大子序列是{4,2},它的和是6。 分析 找最大子序列的方法很简单,扫描数组,当前子序列的和temp_sum,若这个和不断增加,那么最大子序列的和m...

蛇形矩阵

给定一整数n,输出n阶蛇形巨阵的如下形式 例如 三阶蛇形巨阵如下所示 1 2 3 8 9 4 7 6 5 则输出 1 2 3 8 9 4 7 6 5 代码如下 #include <iostream> #include <vector> using namespace std; int main(int argc, const char * arg...

Same Tree

二叉树相同

100. Same Tree 题意 Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same...

Invert Binary Tree

二叉树反转

226. Invert Binary Tree 题意 Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 递归解法 class Solution { public: Tree...

Maximum Depth of Binary Tree

二叉树深度

104. Maximum Depth of Binary Tree 题意 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf nod...

Binary Tree Traversal

二叉树遍历

144.Binary Tree Preorder Traversal 题意 Given a binary tree, return the preorder traversal of its nodes’ values. For example: Given binary tree {1,#,2,3}, return [1,2,3]. 代码 class Solution { p...

Excel Sheet Column Number

leetcode 107

Excel Sheet Column Number 题意: Given a column title as appear in an Excel sheet, return its corresponding column number. 例如 A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ...