Skip to content

Commit ad5e5fa

Browse files
Merge pull request PawanJaiswal08#51 from Anushkaa-Kashyap/Mirror-Reflection
mirror reflection
2 parents 82c2e08 + 5a63620 commit ad5e5fa

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Mirror Reflection.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution {
2+
public int mirrorReflection(int p, int q) {
3+
4+
while(p%2==0 && q%2==0){
5+
p=p/2;
6+
q=q/2;
7+
}
8+
9+
if(p%2==0 && q%2!=0){
10+
return 2;
11+
}
12+
else if(p%2!=0 && q%2==0){
13+
return 0;
14+
}
15+
else{
16+
return 1;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)