0003-longest-substring-without-repeating-characters
0004-median-of-two-sorted-arrays
0011-container-with-most-water
0014-longest-common-prefix
0026-remove-duplicates-from-sorted-array
0033-search-in-rotated-sorted-array
0034-find-first-and-last-position-of-element-in-sorted-array
0035-search-insert-position
0081-search-in-rotated-sorted-array-ii
0108-48-606-construct-string-from-binary-tree
0109-48-606-construct-string-from-binary-tree
0111-48-606-construct-string-from-binary-tree
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0128-longest-consecutive-sequence
0150-evaluate-reverse-polish-notation
0151-reverse-words-in-a-string
0153-find-minimum-in-rotated-sorted-array
0167-two-sum-ii-input-array-is-sorted
0187-repeated-dna-sequences
0209-minimum-size-subarray-sum
0219-contains-duplicate-ii
0238-product-of-array-except-self
0262-20-2974-minimum-number-game
0287-find-the-duplicate-number
0300-longest-increasing-subsequence
0316-remove-duplicate-letters
0316-remove-duplicate-letters.java
0347-top-k-frequent-elements
0350-intersection-of-two-arrays-ii
0367-valid-perfect-square
0374-guess-number-higher-or-lower
0410-split-array-largest-sum
0424-longest-repeating-character-replacement
0438-find-all-anagrams-in-a-string
0448-find-all-numbers-disappeared-in-an-array
0496-next-greater-element-i
0503-next-greater-element-ii
0523-continuous-subarray-sum
0532-k-diff-pairs-in-an-array
0535-encode-and-decode-tinyurl
0540-single-element-in-a-sorted-array
0557-reverse-words-in-a-string-iii
0560-subarray-sum-equals-k
0567-permutation-in-string
0594-longest-harmonious-subsequence
0633-sum-of-square-numbers
0636-exclusive-time-of-functions
0652-303-2231-largest-number-after-digit-swaps-by-parity
0658-find-k-closest-elements
0665-non-decreasing-array
0719-87-2335-minimum-amount-of-time-to-fill-cups
0744-find-smallest-letter-greater-than-target
0844-backspace-string-compare
0852-peak-index-in-a-mountain-array
0881-boats-to-save-people
0929-unique-email-addresses
0930-binary-subarrays-with-sum
0946-validate-stack-sequences
0977-squares-of-a-sorted-array
1011-capacity-to-ship-packages-within-d-days
10170-1490-61-rotate-list
1021-remove-outermost-parentheses
1047-remove-all-adjacent-duplicates-in-string
10578-426-96-unique-binary-search-trees
10579-426-96-unique-binary-search-trees
10582-426-96-unique-binary-search-trees
10938-2130-621-task-scheduler
10945-2130-621-task-scheduler
11297-594-108-convert-sorted-array-to-binary-search-tree
11417-337-40-combination-sum-ii
11532-330-235-lowest-common-ancestor-of-a-binary-search-tree
11537-330-235-lowest-common-ancestor-of-a-binary-search-tree
11557-436-143-reorder-list
1189-maximum-number-of-balloons
11891-240-230-kth-smallest-element-in-a-bst
11915-240-230-kth-smallest-element-in-a-bst
12018-679-92-reverse-linked-list-ii
1209-remove-all-adjacent-duplicates-in-string-ii
12151-388-876-middle-of-the-linked-list
12312-468-24-swap-nodes-in-pairs
12387-261-295-find-median-from-data-stream
12390-261-295-find-median-from-data-stream
12501-1048-199-binary-tree-right-side-view
1283-find-the-smallest-divisor-given-a-threshold
1288-152-1985-find-the-kth-largest-integer-in-the-array
1300-sum-of-mutated-array-closest-to-target
1343-number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold
13894-826-94-binary-tree-inorder-traversal
14034-1006-142-linked-list-cycle-ii
14402-238-226-invert-binary-tree
14454-1558-138-copy-list-with-random-pointer
1456-maximum-number-of-vowels-in-a-substring-of-given-length
1461-check-if-a-string-contains-all-binary-codes-of-size-k
1471-40-2331-evaluate-boolean-binary-tree
1473-41-2331-evaluate-boolean-binary-tree
1475-final-prices-with-a-special-discount-in-a-shop
1482-minimum-number-of-days-to-make-m-bouquets
1539-kth-missing-positive-number
1544-make-the-string-great
15471-1405-160-intersection-of-two-linked-lists
15623-556-105-construct-binary-tree-from-preorder-and-inorder-traversal
15849-405-101-symmetric-tree
15865-406-101-symmetric-tree
15916-339-102-binary-tree-level-order-traversal
16122-1461-141-linked-list-cycle
1614-maximum-nesting-depth-of-the-parentheses
1658-minimum-operations-to-reduce-x-to-zero
17045-916-234-palindrome-linked-list
17379-1397-98-validate-binary-search-tree
1752-check-if-array-is-sorted-and-rotated
1768-merge-strings-alternately
1822-sign-of-the-product-of-an-array
1830-98-1609-even-odd-tree
1838-frequency-of-the-most-frequent-element
1876-substrings-of-size-three-with-distinct-characters
1903-largest-odd-number-in-string
1930-unique-length-3-palindromic-subsequences
19543-833-19-remove-nth-node-from-end-of-list
19615-458-39-combination-sum
1963-minimum-number-of-swaps-to-make-the-string-balanced
1968-array-with-elements-not-equal-to-average-of-neighbors
19743-351-46-permutations
20138-742-23-merge-k-sorted-lists
2144-223-1669-merge-in-between-linked-lists
2149-rearrange-array-elements-by-sign
2173-514-1361-validate-binary-tree-nodes
2174-514-1361-validate-binary-tree-nodes
2197-78-2487-remove-nodes-from-linked-list
2215-find-the-difference-of-two-arrays
2224-269-1863-sum-of-all-subset-xor-totals
22404-496-206-reverse-linked-list
22410-496-206-reverse-linked-list
22781-2223-21-merge-two-sorted-lists
2280-232-1481-least-number-of-unique-integers-after-k-removals
2330-334-988-smallest-string-starting-from-leaf
2331-334-988-smallest-string-starting-from-leaf
2348-number-of-zero-filled-subarrays
2358-maximum-number-of-groups-entering-a-competition
2390-removing-stars-from-a-string
2405-optimal-partition-of-string
2483-minimum-penalty-for-a-shop
2594-minimum-time-to-repair-cars
2616-minimize-the-maximum-difference-of-pairs
2668-312-1405-longest-happy-string
2672-313-1405-longest-happy-string
2696-minimum-string-length-after-removing-substrings
2837-117-951-flip-equivalent-binary-trees
2838-118-951-flip-equivalent-binary-trees
3043-find-the-length-of-the-longest-common-prefix
3057-174-1675-minimize-deviation-in-array
3058-174-1675-minimize-deviation-in-array
32716-6567-2-add-two-numbers
3304-151-1338-reduce-array-size-to-the-half
3551-425-783-minimum-distance-between-bst-nodes
3668-114-2130-maximum-twin-sum-of-a-linked-list
4384-63-958-check-completeness-of-a-binary-tree
5131-358-894-all-possible-full-binary-trees
5473-1653-237-delete-node-in-a-linked-list
5482-191-1721-swapping-nodes-in-a-linked-list
5906-240-979-distribute-coins-in-binary-tree
5932-488-652-find-duplicate-subtrees
5939-490-652-find-duplicate-subtrees
6019-192-1448-count-good-nodes-in-binary-tree
6028-193-1448-count-good-nodes-in-binary-tree
6250-143-1046-last-stone-weight
7711-547-95-unique-binary-search-trees-ii
8273-139-106-construct-binary-tree-from-inorder-and-postorder-traversal
8313-145-129-sum-root-to-leaf-numbers
8550-260-203-remove-linked-list-elements
8702-145-337-house-robber-iii
8737-152-47-permutations-ii
8780-272-767-reorganize-string
8808-530-173-binary-search-tree-iterator
8814-533-173-binary-search-tree-iterator
8889-308-617-merge-two-binary-trees
9058-1248-662-maximum-width-of-binary-tree
9060-1248-662-maximum-width-of-binary-tree
9068-1248-662-maximum-width-of-binary-tree
9074-1249-662-maximum-width-of-binary-tree
9106-253-82-remove-duplicates-from-sorted-list-ii
9563-325-450-delete-node-in-a-bst
9564-325-450-delete-node-in-a-bst
9592-326-450-delete-node-in-a-bst
Folders and files Name Name Last commit message
Last commit date
parent directory Jan 28, 2024
Jan 28, 2024
Jan 28, 2024
View all files
Given a string s
, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
Example 1:
Input: s = "bcabc"
Output: "abc"
Example 2:
Input: s = "cbacdcbc"
Output: "acdb"
Constraints:
1 <= s.length <= 104
s
consists of lowercase English letters.
Note: This question is the same as 1081: https://leetcode.com/problems/smallest-subsequence-of-distinct-characters/
You can’t perform that action at this time.