Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 492 Bytes

14.md

File metadata and controls

24 lines (18 loc) · 492 Bytes
   int count(int i,int x)
    {
        int ans=0;
        string s=to_string(i);
        
        for(int j=0;j<s.size();j++)
            if(s[j]-'0'==x)
                ans++;
        return ans;
    }

    int countX(int L, int R, int X) {
       
        int ans=0;
        
        for(int i=L+1;i<R;i++)
            ans+=count(i,X);
            
        return ans;    
         }