Skip to content

Commit df2e5d8

Browse files
refactor 201 comment
1 parent 03cc97e commit df2e5d8

File tree

1 file changed

+6
-4
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+6
-4
lines changed

src/main/java/com/fishercoder/solutions/_201.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
public class _201 {
1111

1212
public static class Solution1 {
13-
//credit: https://discuss.leetcode.com/topic/28538/java-python-easy-solution-with-explanation
14-
//Bitwise AND operation within range actually turns out to be doing some operations with just these two boundary numbers: m and n
15-
//e.g. 5 and 7, in binary, they are 101 and 111, the result for [5,7] is 5&6&7 which is 101&110&111
16-
//this we can understand it to be shifting the digits of m and n from left to right until they become the same, then we pad that number with zeroes on the right side
13+
/**
14+
* credit: https://discuss.leetcode.com/topic/28538/java-python-easy-solution-with-explanation
15+
* Bitwise AND operation within range actually turns out to be doing some operations with just these two boundary numbers: m and n
16+
* e.g. 5 and 7, in binary, they are 101 and 111, the result for [5,7] is 5&6&7 which is 101&110&111
17+
* this we can understand it to be shifting the digits of m and n from left to right until they become the same, then we pad that number with zeroes on the right side
18+
*/
1719
public int rangeBitwiseAnd(int m, int n) {
1820
int i = 0;
1921
while (m != n) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy