Use HashSet to determine the result
public class SubsetChecker {
public boolean isSubset(char[] first, char[] second) {
Set<Character> set = generateCharacterSet(first);
return containsAll(set, second);
package self.edu.observable; | |
import io.reactivex.Observable; | |
import io.reactivex.Scheduler; | |
import io.reactivex.observers.TestObserver; | |
import io.reactivex.schedulers.Schedulers; | |
import io.reactivex.schedulers.TestScheduler; | |
import org.junit.Assert; | |
import org.junit.Test; |
package com.example.retrofit; | |
import org.junit.Test; | |
import java.io.ByteArrayOutputStream; | |
import java.io.PrintStream; | |
import static junit.framework.TestCase.assertTrue; | |
// 一般來說,只要把名稱取為 ContributorAppTest 即可 |
package edu.self.binding; | |
import android.databinding.BindingAdapter; | |
import android.widget.ImageView; | |
import com.bumptech.glide.Glide; | |
public class CustomSetter { |
import java.math.BigInteger; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Comparator; | |
import java.util.List; | |
public class CombinationCounter { | |
private static List<BigInteger> generateCombinationLimitedBy(int index) { | |
List<BigInteger> sequence = new ArrayList<>(); |
import java.util.HashMap; | |
import java.util.Map; | |
public class SimilarNumberCounter { | |
private static Map<Integer, Integer> digitCounts = new HashMap<>(); | |
private static void initializeDigitCounts() { | |
for (int i = 0; i <= 9; i++) { | |
digitCounts.put(i, 0); |
public class SingletonSample{ | |
private static SingletonSample instance= null; | |
private static Object mutex= new Object(); | |
private String value; | |
private SingletonSample(){} | |
public static SingletonSample getInstance(){ |