package leetcode;

/**
 * https://leetcode.com/problems/bitwise-and-of-numbers-range/
 */
public class Problem201 {
    public int rangeBitwiseAnd(int m, int n) {
        int result = m;
        for (int i = m+1; i <= n; i++) {
            result &= i;
        }
        return result;
    }
    
    public static void main(String[] args) {
        Problem201 prob = new Problem201();
        System.out.println(prob.rangeBitwiseAnd(5, 7)); // 4
    }
}

@@ -172,18 +172,16 @@
 int 
-result = m
+step = 0
 ;%0A  
@@ -190,37 +190,21 @@
     
-for (int i = m+1; i %3C= n; i++
+while (m != n
 ) %7B%0A
@@ -219,19 +219,15 @@
     
-result &= i
+m %3E%3E= 1
 ;%0A  
@@ -236,193 +236,76 @@
     
-%7D%0A
     
-    return result;%0A
+n %3E%3E= 1;%0A    
     
-%7D%0A
     
-%0A    public static void main(String%5B%5D args) %7B%0A        Problem201 prob = new Problem201();%0A        System.out.println(prob.rangeBitwiseAnd(5, 7)); // 4
+step++;%0A        %7D%0A        return m %3C%3C step;
 %0A   

Solve problem 201