首页 > 其他 > 详细

LintCode: Compare Strings

时间:2015-11-27 06:36:53      阅读:287      评论:0      收藏:0      [点我收藏+]

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 };

 

LintCode: Compare Strings

原文:http://www.cnblogs.com/CheeseZH/p/4999495.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!