A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.
For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contains two binary gaps: one of length 4 and one of length 3. The number 20 has binary representation 10100 and contains one binary gap of length 1. The number 15 has binary representation 1111 and has no binary gaps. The number 32 has binary representation 100000 and has no binary gaps.
Write a function:
function solution($N);
that, given a positive integer N, returns the length of its longest binary gap. The function should return 0 if N doesn't contain a binary gap.
For example, given N = 1041 the function should return 5, because N has binary representation 10000010001 and so its longest binary gap is of length 5. Given N = 32 the function should return 0, because N has binary representation '100000' and thus no binary gaps.
Write an efficient algorithm for the following assumptions:
- N is an integer within the range [1..2,147,483,647].
example test n=1041=10000010001_2
tested program terminated with exit code 1
Invalid result type, int expected (got NULL)stdout:
Array ( [0] => 0 [1] => 1 [2] => 0 [3] => 0 [4] => 0 [5] => 1 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 1 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
Invalid result type, int expected (got NULL)stdout:
Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = '';
$cnt = array();
$bin_num = array();
$b = $N / 2;
$bin_num[] = $b % 2;
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
print_R($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = '';
$cnt = array();
$bin_num = array();
$b = $N / 2;
$bin_num[] = $b % 2;
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print_R($bin_num);
return $result;
}
example test n=1041=10000010001_2
tested program terminated with exit code 1
Invalid result type, int expected (got string)stdout:
Array ( [0] => 0 [1] => 1 [2] => 0 [3] => 0 [4] => 0 [5] => 1 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 1 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
Invalid result type, int expected (got string)stdout:
Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = '';
$cnt = array();
$bin_num = array();
$b = $N / 2;
$bin_num[] = $b % 2;
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print_R($bin_num);
return $result;
}
[9]
[15]
[20]
example test n=1041=10000010001_2
tested program terminated with exit code 1
Invalid result type, int expected (got string)stdout:
Array ( [0] => 0 [1] => 1 [2] => 0 [3] => 0 [4] => 0 [5] => 1 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 1 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
Invalid result type, int expected (got string)stdout:
Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
Invalid result type, int expected (got string)stdout:
Array ( [0] => 0 [1] => 1 [2] => 0 [3] => 0 [4] => 1 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
Invalid result type, int expected (got string)stdout:
Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
Invalid result type, int expected (got string)stdout:
Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 1 [4] => 0 [5] => 1 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = ';
$cnt = array();
$bin_num = array();
$b = $N / 2;
$bin_num[] = $b % 2;
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print_R($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$b = $N / 2;
$bin_num[] = $b % 2;
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print_R($bin_num);
return $result;
}
[9]
[15]
[20]
Array ( [0] => 0 [1] => 1 [2] => 0 [3] => 0 [4] => 0 [5] => 1 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 1 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
function result: 0
Array ( [0] => 0 [1] => 1 [2] => 0 [3] => 0 [4] => 1 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
function result: 0
Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
function result: 0
Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 1 [4] => 0 [5] => 1 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 0 [33] => 0 [34] => 0 [35] => 0 [36] => 0 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 0 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 0 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 [91] => 0 [92] => 0 [93] => 0 [94] => 0 [95] => 0 [96] => 0 [97] => 0 [98] => 0 [99] => 0 [100] => 0 [101] => 0 [102] => 0 [103] => 0 [104] => 0 [105] => 0 [106] => 0 [107] => 0 [108] => 0 [109] => 0 [110] => 0 [111] => 0 [112] => 0 [113] => 0 [114] => 0 [115] => 0 [116] => 0 [117] => 0 [118] => 0 [119] => 0 [120] => 0 [121] => 0 [122] => 0 [123] => 0 [124] => 0 [125] => 0 [126] => 0 [127] => 0 [128] => 0 [129] => 0 [130] => 0 [131] => 0 [132] => 0 [133] => 0 [134] => 0 [135] => 0 [136] => 0 [137] => 0 [138] => 0 [139] => 0 [140] => 0 [141] => 0 [142] => 0 [
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$b = $N / 2;
$bin_num[] = $b % 2;
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$b = $N / 2;
$bin_num[] = $b % 2;
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print "this is a debug message\n";
return $result;
}
[9]
[15]
[20]
this is a debug message
this is a debug message
function result: 0
this is a debug message
function result: 0
this is a debug message
function result: 0
this is a debug message
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print "this is a debug message\n";
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print "this is a debug message\n";
return $result;
}
[9]
[15]
[20]
this is a debug message
this is a debug message
function result: 0
this is a debug message
function result: 0
this is a debug message
function result: 0
this is a debug message
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print "this is a debug message\n";
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print $bin_num;
print "this is a debug message\n";
return $result;
}
[9]
PHP Notice: Array to string conversion in func.php on line 16 Notice: Array to string conversion in func.php on line 16stdout:
Arraythis is a debug message
PHP Notice: Array to string conversion in func.php on line 16 Notice: Array to string conversion in func.php on line 16stdout:
Arraythis is a debug message
function result: 0
PHP Notice: Array to string conversion in func.php on line 16 Notice: Array to string conversion in func.php on line 16stdout:
Arraythis is a debug message
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print implod$bin_num;
print "this is a debug message\n";
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print implode($bin_num);
print "this is a debug message\n";
return $result;
}
[9]
10001000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000this is a debug message
11110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000this is a debug message
function result: 0
1001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000this is a debug message
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 0 ) {
$bin_num[] = $N % 2;
$N = $N / 2;
if ($N == 1) break;
}
print implode($bin_num);
print "this is a debug message\n";
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 0 && $N != 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
print implode($bin_num);
print "this is a debug message\n";
return $result;
}
[9]
10001000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000this is a debug message
11110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000this is a debug message
function result: 0
1001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000this is a debug message
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 0 && $N 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
print implode($bin_num);
print "this is a debug message\n";
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
print implode($bin_num);
print "this is a debug message\n";
return $result;
}
[9]
10001000001this is a debug message
1111this is a debug message
function result: 0
1001this is a debug message
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
print implode($bin_num);
print "this is a debug message\n";
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print implode($bin_num);
print "this is a debug message\n";
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = 0 ; $i)
}
print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0)
}
print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $
}
}
print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
}
print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
}
print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
}
print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_nu))
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
$cnt
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
$cnt[$idx] = 0;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
$cnt[$idx] = 0;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
$cnt[$idx] = 0;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
$cnt[$idx] = 0;
$idx++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx)
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx == 0)
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx == 0 && )
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1])
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] != 0)
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) $max = $cnt[$idx];
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
$max = $cnt[$idx];
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max )
$max = $cnt[$idx];
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max >)
$max = $cnt[$idx];
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max > 0)
$max = $cnt[$idx];
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $result;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$result = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
$max = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max > 0)
$max = $cnt[$idx];
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max > 0)
$max = $cnt[$idx];
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max = 0)
$max = $cnt[$idx];
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx];
else
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx];
else {
$max = $max >
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max >
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
example test n=1041=10000010001_2
tested program terminated with exit code 255
PHP Parse error: syntax error, unexpected '++' (T_INC), expecting ')' in func.php on line 26 Parse error: syntax error, unexpected '++' (T_INC), expecting ')' in func.php on line 26
PHP Parse error: syntax error, unexpected '++' (T_INC), expecting ')' in func.php on line 26 Parse error: syntax error, unexpected '++' (T_INC), expecting ')' in func.php on line 26
PHP Parse error: syntax error, unexpected '++' (T_INC), expecting ')' in func.php on line 26 Parse error: syntax error, unexpected '++' (T_INC), expecting ')' in func.php on line 26
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num)."\n";
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num)."\n"\\;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
// $int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
p
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print implode($bin_num);
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
10001000001
1111
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeo($bin_num);
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num);
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11
4
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num);
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num).'\n';
if (sizeof($bin_num) >0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
print $bin_num[$i].'\n';
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11\n
4\n
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num).'\n';
if (sizeof($bin_num) > 0) {
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
print $bin_num[$i].'\n';
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num).'\n';
if (sizeof($bin_num) > 0) { print "debug";
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
print $bin_num[$i].'\n';
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11\ndebug
4\ndebug
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."n";
if (sizeof($bin_num) > 0) { print "debug";
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
print $bin_num[$i].'\n';
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug";
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
print $bin_num[$i].'\n';
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11 debug
4 debug
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug";
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug";
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11 debug
4 debug
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug". ;
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num)-1;
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11 -1
4 -1
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11 debug11
4 debug4
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
for ($i = sizeof($bin_num)-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
$size = sizeof($bin_num)
for ($i = -1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
$size = sizeof($bin_num);
for ($i = -1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
$size = sizeof($bin_num);
for ($i = $size-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11 debug11
4 debug4
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
$size = c($bin_num);
for ($i = $size-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
$size = count($bin_num);
for ($i = $size-1 ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11 debug11
4 debug4
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
$size = count($bin_num);
for ($i = $size ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) { print "debug".sizeof($bin_num);
$size = count($bin_num)-1;
for ($i = $size ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11 debug11
4 debug4
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
print sizeof($bin_num)."\n";
if (sizeof($bin_num) > 0) {
$size = count($bin_num)-1; print $size;
for ($i = $size ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
11 10
4 3
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = count($bin_num)-1; print $size;
for ($i = $size ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1; print $size;
for ($i = $size ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
10
3
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1; print $bin_num[3];
for ($i = $size ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
0
1
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1; print $bin_num[3];
for ($i = $size ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
//$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1; print $bin_num[3];
for ($i = $size ; $i <= 0 ; $i--) {
print $bin_num[$i]."\n";
//$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
0
1
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1; print $bin_num[3];
for ($i = $size ; $i <= 0 ; $i--) {
print "ssss";
//$re_bin_num[] = $bin_num[$i];
}
$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
0
1
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1; print $bin_num[3];
for ($i = $size ; $i <= 0 ; $i--) {
print "ssss";
//$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
print $int_bin_num;
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1; print $bin_num[3];
for ($i = $size ; $i <= 0 ; $i--) {
print "ssss";
//$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
0
1
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1; print $bin_num[3];
for ($i = $size ; $i >= 0 ; $i--) {
print "ssss";
//$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
PHP Notice: Undefined offset: 1 in func.php on line 42 Notice: Undefined offset: 1 in func.php on line 42 PHP Notice: Undefined offset: 2 in func.php on line 42 Notice: Undefined offset: 2 in func.php on line 42stdout:
10000010001
1111
function result: 0
PHP Notice: Undefined offset: 1 in func.php on line 42 Notice: Undefined offset: 1 in func.php on line 42stdout:
1001
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++;
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++; print $idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
PHP Notice: Undefined offset: 1 in func.php on line 42 Notice: Undefined offset: 1 in func.php on line 42 PHP Notice: Undefined offset: 2 in func.php on line 42 Notice: Undefined offset: 2 in func.php on line 42stdout:
100000100011 2 3
11111 2 3 4
function result: 0
PHP Notice: Undefined offset: 1 in func.php on line 42 Notice: Undefined offset: 1 in func.php on line 42stdout:
10011 2
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$idx++; print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
PHP Notice: Undefined offset: 1 in func.php on line 42 Notice: Undefined offset: 1 in func.php on line 42 PHP Notice: Undefined offset: 2 in func.php on line 42 Notice: Undefined offset: 2 in func.php on line 42stdout:
10000010001idx: 1 idx: 2 idx: 3
1111idx: 1 idx: 2 idx: 3 idx: 4
function result: 0
PHP Notice: Undefined offset: 1 in func.php on line 42 Notice: Undefined offset: 1 in func.php on line 42stdout:
1001idx: 1 idx: 2
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
$ print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($idx > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
10000010001idx: 0 idx: 0 idx: 0
1111idx: 0 idx: 0 idx: 0 idx: 0
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ( > 0 && $cnt[$idx-1] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($cnt[$idx] > 0) {
if ($max == 0) $max = $cnt[$idx-1];
else {
$max = $max > $cnt[$idx-1] ? $max : $cnt[$idx-1];
}
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($cnt[$idx] > 0) {
$max = $cnt[$idx];
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($cnt[$idx] > 0) {
$max = $cnt[$idx];
$idx++;
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
PHP Notice: Undefined offset: 0 in func.php on line 32 Notice: Undefined offset: 0 in func.php on line 32stdout:
10000010001idx: 0 idx: 1 idx: 2
PHP Notice: Undefined offset: 0 in func.php on line 32 Notice: Undefined offset: 0 in func.php on line 32stdout:
1111idx: 0 idx: 0 idx: 0 idx: 0
function result: 2
PHP Notice: Undefined offset: 0 in func.php on line 32 Notice: Undefined offset: 0 in func.php on line 32stdout:
1001idx: 0 idx: 1
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($$cnt[$idx] > 0) {
$max = $cnt[$idx];
$idx++;
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($cnt[$idx] != null && $cnt[$idx] > 0) {
$max = $cnt[$idx];
$idx++;
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
PHP Notice: Undefined offset: 0 in func.php on line 32 Notice: Undefined offset: 0 in func.php on line 32stdout:
10000010001idx: 0 idx: 1 idx: 2
PHP Notice: Undefined offset: 0 in func.php on line 32 Notice: Undefined offset: 0 in func.php on line 32stdout:
1111idx: 0 idx: 0 idx: 0 idx: 0
function result: 2
PHP Notice: Undefined offset: 0 in func.php on line 32 Notice: Undefined offset: 0 in func.php on line 32stdout:
1001idx: 0 idx: 1
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($cnt[$idx] != null &&$cnt[$idx] > 0) {
$max = $cnt[$idx];
$idx++;
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if ($cnt[$idx] > 0) {
$max = $cnt[$idx];
$idx++;
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $cnt[$idx];
$idx++;
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
10000010001idx: 0 idx: 1 idx: 2
1111idx: 0 idx: 0 idx: 0 idx: 0
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $ma$cnt[$idx];
$idx++;
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
10000010001idx: 0 idx: 1 idx: 2
1111idx: 0 idx: 0 idx: 0 idx: 0
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
/print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
//print implode($re_bin_num);
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
// print "idx: ".$idx."\n";
}
else {
$cnt[$idx]++;
}
}
}
//print implode($bin_num);
return $max;
}
[9]
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
//$int_bin_num = implode($re_bin_num);
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
$int_bin_num = 0;
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
return $max;
}
[9]
[1041]
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
}
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
return $max;
}
[9]
[20]
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
$re_bin_num[] = $bin_num[$i];
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
// $re_bin_num[] = $bin_num[$i];
if ($bin_)
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
// $re_bin_num[] = $bin_num[$i];
if ($bin_num[$i])
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
for ($i = $size ; $i >= 0 ; $i--) {
// $re_bin_num[] = $bin_num[$i];
if ($bin_num[$i]) {
if
}
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
// $re_bin_num[] = $bin_num[$i];
if ($bin_num[$i]) {
if (sizeof($cnt) > )
}
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
// $re_bin_num[] = $bin_num[$i];
if ($bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else
}
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
// $re_bin_num[] = $bin_num[$i];
if ($bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else $cnt[$idx]++;
}
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
// $re_bin_num[] = $bin_num[$i];
if ($bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else $cnt[$idx]++;
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
// $re_bin_num[] = $bin_num[$i];
if ($bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else $cnt[$idx]++;
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
[9]
[20]
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
// $re_bin_num[] = $bin_num[$i];
if ($bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else $cnt[$idx]++;
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
[9]
[20]
[15]
[1041]
function result: 2
function result: 1
function result: 0
function result: 5
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
if ($bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else $cnt[$idx]++;
}
}
/*
if (sizeof($re_bin_num) > 0) {
$idx = 0;
for ($i = 0 ; $i < sizeof($re_bin_num) ; $i++) {
if ($re_bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else {
$cnt[$idx]++;
}
}
}
*/
return $max;
}
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
if ($bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else $cnt[$idx]++;
}
}
return $max;
}
[9]
[20]
[15]
[1041]
function result: 2
function result: 1
function result: 0
function result: 5
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
if ($bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else $cnt[$idx]++;
}
}
return $max;
}
[9]
[20]
[15]
[1041]
function result: 2
function result: 1
function result: 0
function result: 5
// you can write to stdout for debugging purposes, e.g.
// print "this is a debug message\n";
function solution($N) {
$max = 0;
$cnt = array();
$bin_num = array();
$re_bin_num = array();
if ($N > 0) {
while ( $N > 1) {
$bin_num[] = $N % 2;
$N = $N / 2;
}
}
if (sizeof($bin_num) > 0) {
$size = sizeof($bin_num)-1;
$idx = 0;
for ($i = $size ; $i >= 0 ; $i--) {
if ($bin_num[$i]) {
if (sizeof($cnt) > 0 && $cnt[$idx] > 0) {
$max = $max < $cnt[$idx] ? $cnt[$idx] : $max;
$idx++;
}
$cnt[$idx] = 0;
}
else $cnt[$idx]++;
}
}
return $max;
}
The solution obtained perfect score.
PHP Notice: Undefined offset: 0 in func.php on line 28 Notice: Undefined offset: 0 in func.php on line 28
PHP Notice: Undefined offset: 0 in func.php on line 28 Notice: Undefined offset: 0 in func.php on line 28