Created
April 1, 2020 04:45
-
-
Save wushbin/3f5d2fc3525550b93ea901aabe272d5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| public int subarrayBitwiseORs(int[] A) { | |
| Set<Integer> result = new HashSet<>(); | |
| Set<Integer> current = new HashSet<>(); | |
| for (int num : A) { | |
| Set<Integer> temp = new HashSet<>(); | |
| temp.add(num); | |
| for (int pre : current) { | |
| temp.add(num | pre); | |
| } | |
| result.addAll(temp); | |
| current = temp; | |
| } | |
| return result.size(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment