C++
1 class Solution { 2 public: 3 /** 4 * @param A: A string includes Upper Case letters 5 * @param B: A string includes Upper Case letter 6 * @return: if string A contains all of the characters in B return true 7 * else return false 8 */ 9 bool compareStrings(string A, string B) { 10 // write your code here 11 if (B == "") { 12 return true; 13 } 14 for (int i=0; i<B.size(); i++) { 15 int j = A.find_first_of(B[i]); 16 if (j == -1){ 17 return false;; 18 } else { 19 A[j] = ‘-‘; 20 } 21 } 22 return true; 23 } 24 };
时间: 2024-10-11 21:32:59