Content-Length: 6948 | pFad | http://github.com/fishercoder1534/Leetcode/pull/166.diff
thub.com diff --git a/README.md b/README.md index d93d98dbf8..321a8c008c 100644 --- a/README.md +++ b/README.md @@ -1031,7 +1031,7 @@ _If you like this project, please leave me a star._ ★ | 319 |[Bulb Switcher](https://leetcode.com/problems/bulb-switcher/)| [Solution](../master/src/main/java/com/fishercoder/solutions/_319.java) | |Medium| Brainteaser | 318 |[Maximum Product of Word Lengths](https://leetcode.com/problems/maximum-product-of-word-lengths/)| [Solution](../master/src/main/java/com/fishercoder/solutions/_318.java) | |Medium| | 317 |[Shortest Distance from All Buildings](https://leetcode.com/problems/shortest-distance-from-all-buildings/)| [Solution](../master/src/main/java/com/fishercoder/solutions/_317.java) | |Hard| -| 316 |[Remove Duplicate Letters](https://leetcode.com/problems/remove-duplicate-letters/)| [Solution](../master/src/main/java/com/fishercoder/solutions/_316.java) | |Hard| Stack, Recursion, Greedy +| 316 |[Remove Duplicate Letters](https://leetcode.com/problems/remove-duplicate-letters/)| [Solution](../master/src/main/java/com/fishercoder/solutions/_316.java) | |Medium| Stack, Recursion, Greedy | 315 |[Count of Smaller Numbers After Self](https://leetcode.com/problems/count-of-smaller-numbers-after-self/)| [Solution](../master/src/main/java/com/fishercoder/solutions/_315.java) | |Hard| Tree | 314 |[Binary Tree Vertical Order Traversal](https://leetcode.com/problems/binary-tree-vertical-order-traversal/)| [Solution](../master/src/main/java/com/fishercoder/solutions/_314.java) | |Medium| HashMap, BFS | 313 |[Super Ugly Number](https://leetcode.com/problems/super-ugly-number/)| [Solution](../master/src/main/java/com/fishercoder/solutions/_313.java) | |Medium| diff --git a/_1081.java b/_1081.java new file mode 100644 index 0000000000..9e0ea691ec --- /dev/null +++ b/_1081.java @@ -0,0 +1,44 @@ +package com.fishercoder.solutions; + +import java.util.*; + +// same as 316. Remove Duplicate Letters +// from https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/_316.java + +public class _1002 { + public class Solution1 { + public String smallestSubsequence(String s) { + int[] res = new int[26]; //will contain number of occurences of character (i+'a') + boolean[] visited = + new boolean[26]; //will contain if character (i+'a') is present in current result Stack + char[] ch = s.toCharArray(); + for (char c : ch) { //count number of occurences of character + res[c - 'a']++; + } + DequeFetched URL: http://github.com/fishercoder1534/Leetcode/pull/166.diff
Alternative Proxies: