Untitled
对stack的定势思维
今天在codewar上做了这样一道题
In English and programming, groups can be made using symbols such as () and {} that change meaning. However, these groups must be closed in the correct order to maintain correct syntax.
Your job in this kata will be to make a program that checks a string for correct grouping. For instance, the following groups are done correctly:
({})
[]
[{()}]
The next are done incorrectly:{(})
([]
[])A correct string cannot close groups in the wrong order, open a group but fail to close it, or close a group before it is opened.
Your function will take an input string that may contain any of the symbols (), {} or [] to create groups.
It should return True if the string is empty or otherwise grouped correctly, or False if it is grouped incorrectly.
在我脑海中蹦出来的第一个想法就是使用栈来保存弹出,来判断括号是否匹配
Java动态代理与Cglib代理
最近又继续回来死磕Spring源码,以前看的也忘得差不多了,这次先把Spring使用的动态代理cglib看了一下,打好基础知识。
cglib使用上特别简单,而且也不像Java要实现动态代理一样必须有接口,看一下cglib的wiki可以很容易上手。