判断字符串是否合法
判断字符串是否合法比如 “[]{}”,"[({{[]}})]",为合法“[)]”,"{}{()]}"为不合法考虑用栈,判断是否为左边,为左边就入栈,右边就出栈. public static void main(String[] args) { String s = "{([])}"; System.out.println(getResul(s)); } static boolean getResul(String s){ S
原创
2021-05-28 14:16:38 ·
1923 阅读 ·
0 评论