```
public boolean canConstruct(String ransomNote, String magazine) {
if(ransomNote.length()==0){
return true;
}
if(magazine.length()==0){
return false;
}
char magCharArr[] = magazine.toCharArray();
char ranCharArr[] = ransomNote.toCharArray();
Arrays.sort(magCharArr);
Arrays.sort(ranCharArr);
int i=0;
for(char c:magCharArr){
if(ranCharArr[i]==c){
i++;
if(i==ranCharArr.length){
return true;
}
}
}
return false;
}
```

I am not good at thinking about BigO. I think this solution is O(n) ?

2 Sorting is 2 * nlogn, 1 for loop is n, so O(n) in total? Please correct me if I am wrong. Thanks!!