Skip to content

Commit 059d35c

Browse files
committed
appearence of x in n*n multiplication table , APPLE
1 parent 3c372ae commit 059d35c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Solution/Day-074.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution{
2+
private:
3+
int counter{};
4+
public:
5+
int getAppearingValue( int n , int x ) {
6+
counter = 0;
7+
for(int i=1; i<=n and i<=sqrt(x);++i){
8+
if(!(x%i)){
9+
counter+=(x/i <= n);
10+
counter+=(x/i!=i and x/i<=n and i<=n);
11+
}
12+
}
13+
return counter;
14+
}
15+
};

0 commit comments

Comments
 (0)