LeetCode 刷题问题描述

石头和珠宝

解决代码:

   public static int numJewelsInStones(String J, String S) {
  int K = 0,m = 0;int l=0;int ln = 0;
  int num = 0;
  int result =0;
  int jlenth = J.length();
  int slenth = S.length();
  while(jlenth>l) {
    char c =   J.charAt(K);
    while(slenth>ln) {
    char s  = S.charAt(m);
    if(c-s==0) {
    num++;
        result = num;
     
    }
    m++;
    ln++;
    }
    K++;
    l++;
    ln = 0;
    m = 0;
  }
        return result;   
    }

相关文章:

  • 2021-07-08
  • 2021-10-01
  • 2021-06-22
  • 2022-12-23
  • 2021-08-12
  • 2021-10-29
  • 2021-04-26
  • 2021-10-18
猜你喜欢
  • 2022-03-05
  • 2022-12-23
  • 2021-04-20
  • 2018-03-21
  • 2021-06-15
  • 2021-10-14
  • 2021-05-04
相关资源
相似解决方案