44
55public class Solution {
66 private static final int MX_LN = 61 ;
7- private static final long [][] SLCT = new long [MX_LN ][MX_LN ];
8- private static final int [] POP_HGHT = new int [MX_LN ];
9- private static boolean strt = false ;
7+ private final long [][] slct = new long [MX_LN ][MX_LN ];
8+ private final int [] popHeight = new int [MX_LN ];
9+ private boolean strt = false ;
1010
1111 private void setup () {
1212 if (strt ) {
1313 return ;
1414 }
1515 for (int i = 0 ; i < MX_LN ; i ++) {
16- SLCT [i ][0 ] = SLCT [i ][i ] = 1 ;
16+ slct [i ][0 ] = slct [i ][i ] = 1 ;
1717 for (int j = 1 ; j < i ; j ++) {
18- SLCT [i ][j ] = SLCT [i - 1 ][j - 1 ] + SLCT [i - 1 ][j ];
18+ slct [i ][j ] = slct [i - 1 ][j - 1 ] + slct [i - 1 ][j ];
1919 }
2020 }
21- POP_HGHT [1 ] = 0 ;
21+ popHeight [1 ] = 0 ;
2222 for (int v = 2 ; v < MX_LN ; v ++) {
23- POP_HGHT [v ] = 1 + POP_HGHT [Long .bitCount (v )];
23+ popHeight [v ] = 1 + popHeight [Long .bitCount (v )];
2424 }
2525 strt = true ;
2626 }
@@ -38,7 +38,7 @@ private long countNumbers(long upperLimit, int setBits) {
3838 for (int pos = len - 1 ; pos >= 0 ; pos --) {
3939 if (((upperLimit >> pos ) & 1 ) == 1 ) {
4040 if (setBits - used <= pos ) {
41- count += SLCT [pos ][setBits - used ];
41+ count += slct [pos ][setBits - used ];
4242 }
4343 used ++;
4444 if (used > setBits ) {
@@ -59,7 +59,7 @@ public long popcountDepth(long tillNumber, int depthQuery) {
5959 }
6060 long total = 0 ;
6161 for (int ones = 1 ; ones < MX_LN ; ones ++) {
62- if (POP_HGHT [ones ] == depthQuery - 1 ) {
62+ if (popHeight [ones ] == depthQuery - 1 ) {
6363 total += countNumbers (tillNumber , ones );
6464 }
6565 }
0 commit comments