
leetcode算法刷题计划
大风车呀五六六的转
这个作者很懒,什么都没留下…
展开
-
leetcode数据结构入门-20. 有效的括号
给定一个只包括 ‘(’,’)’,’{’,’}’,’[’,’]’ 的字符串 s ,判断字符串是否有效。 有效字符串需满足: 左括号必须用相同类型的右括号闭合。 左括号必须以正确的顺序闭合。 栈 class Solution { public boolean isValid(String s) { Stack<Character> stack1 = new Stack<Character>(); for(int i = 0;i < s.len原创 2021-08-23 20:13:46 · 102 阅读 · 0 评论 -
leetcode数据结构入门-203. 移除链表元素
给你一个链表的头节点 head 和一个整数 val ,请你删除链表中所有满足 Node.val == val 的节点,并返回 新的头节点 。 方法:递归 class Solution { public ListNode removeElements(ListNode head, int val) { if(head == null){ return head; } head.next = removeElements(head.原创 2021-08-23 18:45:06 · 97 阅读 · 0 评论