重复元素
hmyqwe
这个作者很懒,什么都没留下…
展开
-
leetcode-316-去除重复字母-1081-不同字符的最小子序列
class Solution { public String removeDuplicateLetters(String s) { // 存储结果的栈 Stack<Character> stack = new Stack<>(); // 记录字符串中字符出现的次数 int[] count = new int[26]; for (int i = 0; i < s.length(); i++).原创 2021-04-21 17:11:58 · 64 阅读 · 0 评论 -
leetcode-83-删除排序链表中的重复元素
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this.val = val; } * ListNode(int val, ListNode next) { this.val = val; this.next = next; } * ..原创 2021-04-21 10:25:10 · 53 阅读 · 0 评论 -
leetcode-26-删除有序数组中的重复项
class Solution { public int removeDuplicates(int[] nums) { if (nums.length == 0) { return 0; } // 初始化快慢指针 int slow = 0; int fast = 0; while (fast < nums.length) { if (nums[fas..原创 2021-04-21 10:11:27 · 69 阅读 · 0 评论